In this tutorial, we will show you how to disable WooCommerce payment gateways based on the country of the customer.
You’ll be able to disable or restrict a specific WooCommerce payment method for specific countries.
For example, you may need to disable PayPal or Stripe for non-local customers. You may also need to enable a specific WooCommerce payment gateway for only one country. And we will show you how to do both.
Some reasons to restrict payment gateways based on the customer’s country:
- Your products are not allowed in a specific country.
- The payment gateway is not available for a specific country.
- You want to reduce the risk of credit card fraud from a specific country.
- Billing charges are too high for orders coming from a specific country.
- Etc.
For any of these cases, we’ll show you how to restrict a payment method in a specific country so that the customers visiting your WooCommerce store from that country aren’t able to use it at the moment of purchasing your products. However, the customers from all other countries will be able to use that payment method without issues.
For this, we will use the WooCommerce Conditional Payment Gateways plugin. It allows you to restrict WooCommerce payment methods using conditional logic. You can enable or disable payment methods if the conditions are met, and these conditions can be bases on cart total, billing country, shipping country, shipping method, minimum order total, maximum order total, user role, etc.
You can download the plugin here:
Download WooCommerce Conditional Payment Gateways Plugin - or - Read more
After installing the plugin, you can go to WooCommerce > Conditional Payment Methods.
You just need to click on Add condition.
And now you can proceed to disable WooCommerce payment methods for specific countries.
Follow the steps in the sections below:
Disable WooCommerce payment gateway for specific country
In this section, we will show you how to enable specific payment gateways for all countries but disable it for a specific country.
For this, you just need to select the following values to add a new condition:
- 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: In this example, we will disable the PayPal payment gateway.
- Conditions: Group 1: Here we need to select the Billing country field, the equal (=) operator, and the country where we want to disable the selected payment gateway. In this case, we will disable credit card usage for customers from Afghanistan.
- Note. If you want to disable WooCommerce payment gateways in more than one country, you can click on the Add ‘Or’ group button to add another condition.
- Click Publish.
Once we have published our condition, we’ll see that the PayPal gateway is available for countries like the United States and others.
However, if we select the restricted country (Afghanistan in this case), PayPal is disabled.
Disable WooCommerce payment method for all countries except for your country
In this section, we want to show you how to disable a WooCommerce payment gateway for all countries, but keep it active for your country.
For example, you may want to enable the Direct bank transfer gateway for your country but disable it for all the other countries.
You need to select these values:
- Enter the Condition title in the Add new condition field
- What happens when the conditions are met: Enable the payment method(s)
- Select the payment methods: In this example, we will enable the Direct bank transfer (bacs) payment gateway.
- Conditions: Group 1: Here we need to select the Billing country field, the equal (=) operator, and the country where we want to enable the selected payment gateway. In this case, we will enable direct bank transfers for the US only. All other countries won’t be able to use this payment gateway.
- Click Publish.
After publishing the condition, we will see that, if we select our country (United States in this case), the Direct bank transfer gateway is available.
However, if we select any other country, the Direct bank transfer gateway is disabled.
The WooCommerce Conditional Payment Gateways plugin is the best way to enable or disable payment methods based on the country. You can also use any other condition to disable your payment gateways.
You can download the plugin here:
Download WooCommerce Conditional Payment Gateways Plugin - or - Read more