Let’s take a look at how to disable WooCommerce payment gateways by shipping class.
This can serve as a security measure against credit card fraud.
Let’s put it this way:
- You sell big and expensive products (leather sofas, cars, etc.).
- These products belong in the “Bulky products” shipping class.
- You want to disable a payment gateway (Stripe, PayPal, etc.) for all products in the “Bulky products” shipping class to prevent customers from purchasing those products using a credit card.
- This will allow you to prevent credit card fraud.
This is just one of the examples where you might need to disable payment methods for product shipping classes in WooCommerce.
This is something you cannot normally do with WooCommerce only.
The good news is that we can do that with the Conditional Payment Gateways plugin.
It allows you to add conditional logic to your WooCommerce payment gateways’ availability.
You can download the plugin here:
Download WooCommerce Conditional Payment Gateways Plugin - or - Read more
After installing and activating the plugin, you can follow the steps in the sections below in order to disable payment gateways by shipping class.
1- Add a new condition
Go to WooCommerce > Conditional Payment Methods.
Now click on Add condition to create a new condition.
2- Disable WooCommerce payment gateways by shipping class
You need to select these values in order to disable WooCommerce payment gateways by product shipping classes:
- Add new condition – Enter the condition title
- What happens when the conditions are met – Disable the payment method(s)
- Select the payment methods – In this example, we will select the Stripe gateway. You can select any other, add more methods, etc.
- Condition 1 – Taxonomy: Product shipping classes = Bulky products, for example.
- Click on Publish
By setting these values, you’ll be able to block the use of specific payment gateways for products with a specific shipping class.
You can download the plugin here:
Download WooCommerce Conditional Payment Gateways Plugin - or - Read more
You can read more tutorials about this plugin by clicking here.