Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is working on a site with multiple domains using WPML and WooCommerce for regions like the USA, UK, and Germany. They want to restrict customers from ordering from certain domains based on their shipping address, but the WooCommerce option 'Sell to all countries, except for…' applies globally and does not allow for domain-specific restrictions.
Solution:
We recommend using custom hooks to achieve domain-specific restrictions. One approach is to use the

woocommerce_checkout_process

hook to check the current domain against the customer's shipping country. If there is a mismatch, display an error and prevent checkout. Alternatively, consider redirecting customers to the correct store based on their location or using third-party plugins like Conditional Shipping and Payments for more flexibility.

It's important to note that restricting EU customers based on their shipping address might violate EU price discrimination laws, particularly under the Geo-blocking Regulation (EU) 2018/302. This regulation prohibits unjustified geo-blocking and discrimination based on nationality, residence, or place of establishment within the EU. Ensure compliance when implementing any restrictions.

If this solution does not apply to your case, or if it seems outdated, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If further assistance is needed, please open a new support ticket at WPML support forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 1 reply, has 0 voices.

Last updated by Marcel 1 week ago.

Assisted by: Marcel.

Author Posts
January 28, 2025 at 4:53 pm #16643402

davidH-172

Background of the issue:
I am working on a site under development with multiple domains using WPML and WooCommerce for regions like USA, UK, and Germany. I want to restrict customers from ordering from certain domains based on their shipping address. Normally, I would use the built-in WooCommerce option 'Sell to all countries, except for…', but this option applies globally to all domains.

Symptoms:
The WooCommerce option 'Sell to all countries, except for…' is global and does not allow for domain-specific restrictions.

Questions:
How can I stop people from ordering on a site based on their shipping address? e.g if someone is on the USA store, stop them choosing a UK address.

See video hidden link

January 29, 2025 at 8:44 am #16644953

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

This behavior is expected, as all WooCommerce settings are applied globally.

To achieve the functionality you need, you can try using custom hooks. One option is to hook into woocommerce_checkout_process and check the current domain and the customer's shipping country. If the shipping country does not match the allowed region for that domain, you can display an error and prevent checkout.

Alternatively, you could redirect customers to the correct store based on their location or explore third-party plugins such as "Conditional Shipping and Payments" for a more flexible solution.

Important Consideration:
Restricting EU customers from ordering based on their shipping address could potentially violate EU price discrimination laws, particularly under the Geo-blocking Regulation (EU) 2018/302. This regulation prohibits unjustified geo-blocking and discrimination based on nationality, residence, or place of establishment within the EU. I strongly recommend keeping this in mind when implementing any restrictions to ensure compliance.

Best regards,
Marcel