Created
June 20, 2022 20:12
-
-
Save KristaButler/7ad0b966930a900e0d7667829d1abe94 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('mepr_options_helper_payment_methods', function($payment_methods, $key) { | |
//Change these to be in the order you want, you can also remove any you don't need | |
//(Note: paypal pro and express included for backwards compatibility) | |
$order = array( | |
"PayPal", | |
"PayPal Express Checkout", | |
"PayPal Payments Pro", | |
"PayPal Standard", | |
"Stripe", | |
"Authorize.net", | |
"Offline Payment", | |
); | |
$pm_map = array(); | |
$mepr_options = MeprOptions::fetch(); | |
$option_methods = $mepr_options->payment_methods(); | |
foreach($payment_methods as $pm_key) { | |
$pm = $option_methods[$pm_key]; | |
$pm_map[$pm->name] = $pm_key; | |
} | |
if (count($pm_map) > 0) { | |
$payment_methods = array(); //reset | |
foreach ($order as $name) { | |
$next = $pm_map[$name]; | |
if (isset($next)) { | |
$payment_methods[] = $next; | |
} | |
} | |
} | |
return $payment_methods; | |
}, 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment