Easy Digital Downloads lets you enable multiple payment gateways to give customers a choice about how they want to pay. The core plugin also lets you choose a default option, but it doesn’t let you choose the order that options are presented at checkout. That can lead to odd UX where the default selected option appears second, or third in the list:
Fortunately, it’s pretty easy to change this order – simply paste the following function into your theme’s functions.php
file, or use a functionality plugin. Just change the $gateway_order
array to the gateways you have enabled, in the order you want them, and you’re good to go.
function lw_edd_enabled_payment_gateways($gateways) { $gateway_order = array( 'stripe', 'paypal', 'manual', ); $new_gateways = array(); foreach ( $gateway_order as $gateway ) { if ( ! empty( $gateways[$gateway] ) ) { $new_gateways[$gateway] = $gateways[$gateway]; } } return $new_gateways; } add_filter( 'edd_enabled_payment_gateways', 'lw_edd_enabled_payment_gateways', 10, 1 );
Here’s what our revised default checkout looks like – much neater.
3 Comments
Leave a reply →