In this tutorial, we will show you how to disable WooCommerce payment gateways for specific discount coupon codes.
This is really useful to prevent users from using a specific payment gateway when using a discount coupon code on checkout.
For example, you may want to restrict the Cash on pickup and Cash on delivery payment methods when customers apply a specific coupon code at checkout.
Another example may be that you need to disable credit card when customers apply a specific discount coupon on checkout.
You can disable WooCommerce payment methods for specific discount coupons with the WooCommerce Conditional Payment Gateways plugin.
This plugin allows you to apply conditional logic to your WooCommerce payment gateways. You can restrict or allow payment methods based on conditions like billing country, cart total, discount total, coupon code, shipping method, etc.
You can download the plugin here: Download WooCommerce Conditional Payment Gateways Plugin - or - Read more
After installing and activating the plugin, you need to follow the steps we show you below in order to disable payment method for coupon code.
1- Add a new condition to your payment gateways
Go to WooCommerce > Conditional Payment Methods.
Click on the Add condition button to create a new condition.
3- Disable WooCommerce payment methods for specific coupon codes
In this example, we want to disable the Cash on delivery and the Cash on pickup payment gateways for specific coupon codes.
For this, we need to add a condition using the following values:
- Enter the condition title in the Add new condition field.
- What happens when the conditions are met: Disable the payment method(s)
- Select the payment methods: Here you need to select the payment gateways you want to disable for selected discount coupon codes.
- In this case, we will disable the payment methods for two specific discount coupons, so we need to select the Coupon field, the Equal (=) operator, and then select the coupon for which we want to disable the selected payment gateways.
- Then, we need to click on Add ‘Or’ group and select the Coupon field again, the Equal (=) operator, and then select the other coupon for which we want to disable the selected payment methods.
- Finally, let’s click on the Publish button.
3- Test your disabled payment methods with specific coupons
After publishing the condition, we can proceed to test how the condition works.
In the screenshot below, you can see that we have applied a specific coupon on checkout, but this is not one of the coupons we added in the condition. Therefore, all the payment gateways are available for this discount coupon.
However, if we apply the discount code that we added in the condition, the restricted payment methods are not available.
The same happens when users add two or more discount coupons and one of them is added to the condition. The restricted coupon will hide the payment gateway on checkout, although the other applied coupons are not restricted. 🙂
In this tutorial, we have explained to you how to disable payment gateways for specific WooCommerce discount coupon codes, using the WooCommerce Conditional Payment Gateways plugin.
You can download the plugin here: Download WooCommerce Conditional Payment Gateways Plugin - or - Read more