MarketPress re-order payment gateways on checkout form

When multiple payment gateways are enabled in MarketPress, they appear on the checkout form in the same order as they appear in the site admin, with the first gateway selected by default as the primary.

However, there appears to be no way to re-order the gateways on the checkout page, or set which should be enabled by default. Can that please be added as options in the admin, or perhaps as parameters to the [mp_checkout] shortcode?

  • Ash
    • WordPress Hacker

    Hello Sten

    That’s a nice suggestion. I am marking this as a feature request for now, so other members can add their suggestions as well.

    Meantime, as a workaround, you can try this code:

    add_filter( 'mp_payment_options_array', function( $options ) {
    $temp = array();
    $temp['paypal_express'] = $options['paypal_express'];
    $temp['stripe'] = $options['stripe'];
    $temp['manual_payments'] = $options['manual_payments'];

    return $temp;
    }, 10 );

    On the above example, I had three gateway active, so I re-shuffled them in a temporary array using a filter and then returned that shuffled array.

    You can use this code in your child theme’s functions.php if the theme is not changed. Otherwise mu-plugin is the best option. To create a mu-plugin, go to wp-content/mu-plugins folder. If there is no mu-plugins folder then, create one. Now, inside the mu-plugins folder create file with name anything.php (make sure file extension is .php). Now start with a <?php tag and then put the above code.

    Have a nice day!



Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.