autoship_get_available_valid_customer_saved_methods()

(src/payments.php) Takes a customer id as an argument and returns an array all saved payment methods for that customer associated with Autoship supported payment gateways.

Function:

/**
 * Returns the current valid saved payment methods for a customer.
 * @param int   $customer_id The WC Customer ID.
 * @return array The valid supported saved methods
 */
function autoship_get_available_valid_customer_saved_methods( $customer_id ){

  // get the users current methods if methods aren't supplied
  $methods = wc_get_customer_saved_methods_list( $customer_id );

  // filter the methods for only valids.
  return autoship_filter_saved_methods( $methods );

}

Still need help? Contact Us Contact Us