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.

How to create a location-based rule

  1. Go to WooCommerce > Settings > Payments, then open Conditions and click Add New. Turn on Status and enter a Rule Name.
  2. In Conditions, choose a location field such as Country, City, or Postcode, an operator such as Equal to ( = ), and a value (for example, India).
  3. In Actions, choose Enable Payments Methods or Disable Payments Method, or in Pro Add Payment Method Fee. Click Save Changes, then test checkout.
A Country condition set to Equal to India, with an Enable Payments Method action for Cash on delivery
Figure - A Country rule that enables Cash on Delivery for India
Checkout with Country / Region set to India, showing Direct bank transfer, Check payments, and Cash on delivery, with an annotation that COD is enabled only for country India
Figure - A checkout page for India with Cash on Delivery available

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.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.