How to create customer's location based conditional payments rule
You can show or hide payment methods based on the customer’s location, using address fields such as Country, City, or Postcode.
In the current admin, these fields are in the Billing Address group. Existing documentation also describes a Shipping Address group, which is not visible in the current condition dropdown screenshot. The example below uses a Country condition.
In The Article
How to create a location-based rule
- Go to WooCommerce > Settings > Payments, then open Conditions and click Add New. Turn on Status and enter a Rule Name.
- In Conditions, choose a location field such as Country, City, or Postcode, an operator such as Equal to ( = ), and a value (for example, India).
- In Actions, choose Enable Payments Methods or Disable Payments Method, or in Pro Add Payment Method Fee. Click Save Changes, then test checkout.
Pro Tips
- In the current admin, start from the Billing Address group for Country, City, and Postcode.
- You can combine a location condition with a cart or customer condition in the same rule.
- The example screenshot shows the older singular Enable Payments Method label. The current form shows Enable Payments Methods.
Common Use Cases
1. Enable Cash on Delivery only for a country
Use Country Equal to ( = ) India and Enable Payments Methods for Cash on delivery, as in the example above.
2. Add a fee for a city (Pro)
Use City with Add Payment Method Fee if you need a location-based processing fee.
3. Hide a method for selected postcodes
Use Postcode with Disable Payments Method for the method you want to hide in those areas.
FAQs
1. Which location fields can I use?
The current admin shows Country, State / Province, City, Postcode, and other fields in Billing Address. Older screenshots also show a Shipping Address group. That group is not visible in the current dropdown screenshot.
2. What does the example rule do?
It uses Country Equal to ( = ) India and enables Cash on delivery.
3. Can I add a fee based on location?
Yes, in Pro, with Add Payment Method Fee on the same rule or a separate rule.