Payments: Display an Unsupported Payment Gateway at Checkout

This example will allow a non-supported Payment Gateway for Autoship Cloud to be available when the customer has 1 or more products selected for Autoship in their cart. This example expands the available Payment Gateways to include Cash On Delivery (to use with the "Other" payment method type enabled in QPilot). 

Important: Always test customizations to your site on a staging environment before making changes to your live / production site.  If you are not experienced with testing changes on a staging site, here is a good article to review.

Snippet:

/**
 * Expands the Checkout Supported Payment Gateways for Scheduled Items
 * ex. Add COD ( Cash on Delivery )
 *
 * @param array $gateways
 * @return array The extended gateways
 */
function xx_extend_available_autoship_checkout_gateways( $gateways ){


  $gateways['cod'] = 'payment_method_cod';
  return $gateways;


}
add_filter('autoship_valid_payment_method_ids', 'xx_extend_available_autoship_checkout_gateways', 10, 1 );

Result:

Still need help? Contact Us Contact Us