Disable WooCommerce Payment Gateways Based On Cart Amount

Disable WooCommerce payment gateways is fairly straight forward once you know what the name of the gateway is. The following code will disable paypal and stripe payment gateways on the WooCommerce checkout page when the cart amount is greater than $1000. You can adjust the code to disable payment gateways based on certain products that are in the cart also.

6 thoughts on “Disable WooCommerce Payment Gateways Based On Cart Amount

  1. is there anyway to use this but add something which means it won’t apply if the user has a certain role?

    for instance it’ll run for role:customers but not for role:wholesale

    1. Yes you can do that just surround the part that unsets the array with something like this

      if( current_user_can('customers')) {
      unset($gateways['paypal']);
      }

      This will remove the PayPal gateway if the logged in user is of type ‘customer’

  2. Hey, thanks for that! Is there any way to disable WooCommerce Payment Gateways when total amount “< 1" or "= 0".

    I don't want to show the Payment Gateways when a customer get's free product (because of coupon code).

    Thanks

  3. Can this be modified so that when the cart exceeds 82 kg (we have a set limit of 82 kg before we have to manually adjust freight cost) it will hide Stripe as payment method?

Leave a Reply

Your email address will not be published. Required fields are marked *