I checked the relevant documents and found that liquid does not provide relevant fields, please help me, thank you
Topic summary
The discussion centers on accessing a Shopify store’s primary market information directly through Liquid templates, similar to how {{ shop.currency }} retrieves currency data.
Initial Problem:
- Users sought a straightforward Liquid field to identify the store’s main/primary market
- GraphQL API offers this via
primarymarketquery, but requires app integration rather than direct template access
Proposed Solutions:
Current Market Detection:
{{ localization.market.handle }}retrieves the active market{{ localization.market.primary }}returns a boolean but doesn’t provide the primary market’s handle
Primary Market Identification:
{{ shop.address.country.market }}accesses the market covering the shop’s country- Iterating available countries:
{{ localization.available_countries | map: 'market' | unique }}lists all markets - Using market-specific metafields as filters
Locale-Based Approach:
{{ request.locale.primary }}identifies if current locale is primary- Additional locale properties available:
iso_code,name,root_url
Status:
Multiple workarounds exist, though no single definitive “primary market handle” field was confirmed in Liquid documentation. The discussion remains useful for developers seeking market detection methods.
Thank you for your reply, but this may not be the answer I want. What I want is whether the Liquid template provides information that can get the main market of the shop. For example, to get the currency information of the shop, you can use {{ shop.currency }}
@JasperXXX do you have the answer on your question? i also looking for this value in the liquid, but i found this only >> https://shopify.dev/api/admin-graphql/2022-07/objects/Market#query-primarymarket
hopefully there is a straight-forward access in the liquid instead of using app
@ikkifujiwara Sorry, I haven’t found a solution yet ![]()
To find the current market use {{ localization.market.handle }}
Unless I miss my guess, I think the OP is looking to get the shop to report what it thinks is the current primary market.
Supposedly, it’s easy enough to check if you’re IN the primary market (bool: localization.market.primary) but not what the actual handle is. For example:
**<H1>MARKET:**
** {% if localization.market.primary %}**
** PRIMARY**
** {% else %}**
** SECONDARY ({{ localization.market.handle }})**
** {% endif %}**
**</H1>**
Did NOT yield the results I wanted. Our primary market is the us, I was expecting “PRIMARY”, however, when I used the code above, it displayed:
**MARKET: SECONDARY (us)**
I would like to know the actual handle of the primary market.
NOTE:
I went back to search for “localization.market.primary” and couldn’t find the reference I had looked at. Maybe an old version of something, but I can’t re-verify. localization.market.handle does work, though.
I know this is an old topic but you can itterate the available markets by itterating all available countries and get all markets of the countries
{{ localization.available_countries | map: 'market' | unique }}
To get the primary market you could set a metafield for the specific market and filter the available markets (see above) with this metafield data to get the specific market.
You can get the shop primary market using this liquid
{{ shop.address.country.market }} , this will get the market that covers the shop’s country
request.locale === shop_locale
{{ request.locale.endonym_name }} string
{{ request.locale.iso_code }} string
{{ request.locale.name }} string
{{ request.locale.primary }} bool
{{ request.locale.root_url }} string
request.locale === shop_locale
{{ request.locale.endonym_name }} string
{{ request.locale.iso_code }} string
{{ request.locale.name }} string
{{ request.locale.primary }} bool
{{ request.locale.root_url }} string