WooCommerce – Disable Payment Gateway for Specific Products

Let’s see how to disable a WooCommerce payment gateway for specific products. The customer will not be able to use a specific payment method on Checkout if a specific product is in the cart.

Previously, we have shown you how to disable a payment method for a complete product category in WooCommerce.

However, we got an email from a user asking us about the possibility to disable a payment gateway for a specific group of products that are not integrated in any category or that belong to a category that contains other products for which they don’t want to disable the payment gateway.

For example, if you have a Fashion category in your store, it may include all kinds of fashion items. However, you want to disable a payment gateway for some specific products in that category.

WooCommerce Conditional Payment Gateways plugin

We’ll show you how to disable a payment gateway for specific products using the Conditional Payment Gateways plugin.

It allows you to add conditional logic to your WooCommerce payment methods, so you can enable or disable payment gateways based on those conditions.

Create a new condition

After installing and activating the plugin, go to WooCommerce > Conditional Payment Methods.

Once there, you need to click on the Add condition button.

woocommerce disable payment gateway for specific products

Disable payment gateway for specific products

Let’s say, for example, that you want to disable the Stripe payment method when customers add the following products to the cart:

  • DNK Black Shoes
  • DNK Blue Shoes
  • DNK Black Sports Shoes

For this, you need to create a new condition with these values:

woocommerce disable payment gateway for specific products
  • What happens when the conditions are met: Disable the payment method(s)
  • Enabled payment gateways – Stripe
  • Add new condition – Enter condition title. We’ll call it, “No credit card for specific products”.
  • Conditions 1: Contains product = Select the product. In this case, we will select our DNK Blue Shoes product.
    • Note – We’re adding three products, but you may want to add one product only, or even more products that we’re selecting. It’s up to you.
  • To add another product, click on Add “Or” group. This means the cart may contain either the first product we selected or the product we’re adding below.
    • Note – If the cart MUST have both product, you don’t need an OR group. You just need to click on + to add another condition in the same group.
  • Conditions 1: Contains product = Select the product. In this case, we will select our DNK Black Shoes product.
  • To add another product, you can click on Add “Or” group
  • Conditions 1: Contains product = Select the product. In this example, we will select our DNK Black Sports Shoes product.
  • Click on Publish

After saving this condition, our customers won’t be able to use the selected payment gateway if any of the selected products is in the cart. That’s how you can disable WooCommerce payment gateway for specific products.

If you want to find many more ways to manage your payment gateway availability, you can read more tutorials by clicking here.