Created
October 1, 2019 02:58
-
-
Save messica/379c556f77882372672c11ed3ffd98d8 to your computer and use it in GitHub Desktop.
Randomly choose a gateway from valid gateways.
This file contains hidden or 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
<?php | |
// Add "authorizenet" to valid gateways. | |
function my_pmpro_valid_gateways( $gateways ) { | |
global $gateway, $pmpro_valid_gateways; | |
$gateways[] = 'authorizenet'; | |
$pmpro_valid_gateways = $gateways; | |
return $gateways; | |
} | |
add_filter( 'pmpro_valid_gateways', 'my_pmpro_valid_gateways' ); | |
// Randomly choose a gateway from valid gateways. | |
function my_pmpro_checkout_preheader_before_get_level_at_checkout() { | |
global $gateway, $pmpro_valid_gateways; | |
$gateway = $pmpro_valid_gateways[rand( 0, count( $pmpro_valid_gateways ) - 1 ) ]; | |
} | |
add_action( 'pmpro_checkout_preheader_before_get_level_at_checkout', 'my_pmpro_checkout_preheader_before_get_level_at_checkout' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment