Skip to content

Instantly share code, notes, and snippets.

@patrickposner
Created March 26, 2018 09:15
Show Gist options
  • Save patrickposner/66048e886270f29e45301b88c76ae1b4 to your computer and use it in GitHub Desktop.
Save patrickposner/66048e886270f29e45301b88c76ae1b4 to your computer and use it in GitHub Desktop.
conditional payment method
add_filter( 'woocommerce_available_payment_gateways', 'gm_conditional_payment', 1 );
function gm_conditional_payment( $gateways ) {
global $woocommerce;
if ( $woocommerce->cart->total > 1000 ) {
unset( $gateways['german_market_purchase_on_account'] );
}
return $gateways;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment