Method to hide variants depending on geolocation of customer?

Topic summary

Goal: Hide/show product variants based on the customer’s location (e.g., variants stocked in Europe hidden from US shoppers).

Proposed approach: Use a geolocation API to detect the visitor’s country and filter variants in the Shopify theme. One suggestion is ipstack.com for IP-based geolocation, combined with edits to the product-template Liquid file to only render allowed variants. Variants should have metafields indicating eligible countries. (Liquid = Shopify’s templating language; metafields = custom data fields.)

Considerations: A participant notes an app-based solution works for hiding but slows the site, impacting UX. They argue this capability should be native given Shopify Markets (Shopify’s multi-region selling framework), and also mention hiding when stock is zero as a desired built-in feature.

Status: No confirmed, shared implementation in-thread. One responder offered private help; another user followed up asking if a solution was found. The discussion remains open with the main actionable path being geolocation + Liquid + metafields.

Summarized with AI on December 31. AI used: gpt-5.

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

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!

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.

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.