Shopify themes, liquid, logos, and UX
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
I checked the relevant documents and found that liquid does not provide relevant fields, please help me, thank you
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
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