autoship_get_available_valid_gateways()

(src/payments.php) Returns an array of all available Autoship supported payment gateways currently active for the site.

Function:

/**
 * Returns the current sites valid payment gateways
 * @return array The valid supported payment gateways
 */
function autoship_get_available_valid_gateways(){

  // Get the currently enabled gateways
  $current_gateways = WC()->payment_gateways->get_available_payment_gateways();

  // Get the valid Autoship Payment Gateways ids
  $valid_gateways = autoship_get_valid_payment_methods();

  // Return only valid gateways
  return array_intersect_key( $current_gateways, $valid_gateways );

}

Still need help? Contact Us Contact Us