Skip to content

Instantly share code, notes, and snippets.

@danielimmke
Last active November 29, 2020 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielimmke/ce79b813b092f6efb72921211ed58ebd to your computer and use it in GitHub Desktop.
Save danielimmke/ce79b813b092f6efb72921211ed58ebd to your computer and use it in GitHub Desktop.
Disable Credit Card
<?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