Method to hide variants depending on geolocation of customer?

Method to hide variants depending on geolocation of customer?

ExactArt
Visitor
2 0 0

Hi,

 

I was wondering if it is possible to show/hide product variants depending on the location of the customer?

 

For example we stock some variants in Europe but not in the US, would it be possible for me to hide those variants when a US customer is viewing them rather than just charging extra to ship them from Europe.

 

I look forward to reading any responses!

 

Kind regards,

Mike

Replies 3 (3)

JHKCreate
Shopify Partner
3571 638 926

Hi @ExactArt 

 

This is indeed doable through a combination of Geolocalization APIs that communicate the user's location and the implementation in the liquid code that fetches the appropriate variants through the value shared by the API.

 

Sharing a solution isn't very straightforward here, should you want to tackle this from your end I suggest you use ipstack.com as a starting point and merging this with the product-template liquid file that controls the variants displayed to the user. Variants would need metafields for country detection and selection.

 

Should you need assistance please don't hesitate to reach out privately so our team can get this done for you if needed.

 

Cheers!

Did we solve your issue? Like & Mark As Solution to help the community
Should you need any direct help: contact@jhkcreate.com

Learn more about us: jhkcreate.com
ReneWasabi
Tourist
5 0 0

That app slows down the site. Not great for the UX.

Even though the hiding does work well.

But this (and hiding when stock is zero) should have been integrated in Shopify from when you started with Markets etc. 

Scruffydave
Visitor
3 0 0

Hi Mike did you find a solution to this issue? I have a similar problem. I want to hide certain variants from USA customers and hide other variants from UK customers.