Menu Close

How to disable payment gateway on orders above $10

codeamend
This is a cool function you can apply to any payment gateways for any order threshold. for example, you may want to disable bank transfers if orders are below $10, or disable PayPal payments if orders are above a certain cart total. Use the below codes.
Disable Payment Gateway(PayPal) based on order total – WooCommerce Checkout
add_filter( 'woocommerce_available_payment_gateways', codeamend_disable_paypal);
 
function codeamend_disable_paypal( $available_gateways ) {
$maximum = 10;
if ( WC()->cart->total > $maximum ) {
unset( $available_gateways['paypal'] );
}
return $available_gateways;
}
 
Note to find payment gateway slug: When you hover the payment gateway name in Woocommerce payment settings you can find refer: https://example.com/wp-admin/admin.php?page=wc-settings&tab=checkout&section=paypal

Share

Posted in WooCommerce

You can also read...

Leave a Reply

Your email address will not be published.