-
-
Save danielimmke/ce79b813b092f6efb72921211ed58ebd to your computer and use it in GitHub Desktop.
Disable Credit Card
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
<?php | |
/** | |
* Disable credit card gateway if the total order exceeds $3,000. | |
*/ | |
function danieldo_filter_gateways($gateways){ | |
global $woocommerce; | |
// Check if the total cart amount is more than $3,000. | |
if( $woocommerce->cart->cart_contents_total >= 3000.00 ) { | |
// If it is, remove the gateway. | |
unset($gateways['gateway_name']); | |
} | |
return $gateways; | |
} | |
add_filter('woocommerce_available_payment_gateways','danieldo_filter_gateways',1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment