How can I access the market metafields in Shopify?

DavidWigginsAve
Shopify Partner
7 0 7

Hi Guys

 

not really a question but it may be useful for those looking for this solution - was looking for the answer to this for weeks!

 

You can access the relatively new markets metafield using the localization.market.metafields.custom.XYZ in liquid

 

The results are beautiful of course with 1000s of use cases. For us it allowed us to set a free shipping threshold message on a per market basis in the cart

Working to change the world
Replies 8 (8)

Rick-InventoryH
Shopify Partner
118 6 10

Hi @DavidWigginsAve , 

Thank you for sharing so important information with the community!!

Ricardo | InventoryHero app Specialist
InventoryHero - Automatically Discount Weak Inventory
https://apps.shopify.com/inventory-hero

https://inventoryhero.app

Ottawa, ON, Canada
DavidWigginsAve
Shopify Partner
7 0 7

Thank you 😊 It was bugging me for weeks about working out feasible use cases for the market.metafield without much documentation out there provided by Shopify 

 

like I said the use cases are limitless. For me personally it has solved my problem in being able to communicate free shipping messaging accurately and effectively across my site

Working to change the world
dbw-775
Tourist
6 0 3

Hi David, 

I was just about to post a question about this subject so thought I'd ask you first.

 

My use case for this is to have a custom message for each Market, so that users can see that we ship certain versions of our product to various Markets.

 

I've setup the custom object and then assigned the unique message to each of my Markets.  


The only thing I can't do is reference that object as a dynamic source in any parts of my 2.0 theme...

 

If I try to add this to a header, product page, footer etc - nowhere does it let me pull in that data source.


Can I ask how you did that please?

Oscaaar
Visitor
1 0 0

Same problem here

Francois_MAS
Shopify Partner
1 0 0

Same as well. This is such a pity, Market metafields are really useless if you can't use them in theme 2.0 ...

ThangCQ
Shopify Partner
25 2 6

It's work, thank you so much. How do you know it. Is there any document relate to it. Because when I read in metafield document, it's just shown below without localization.market

Screenshot 2023-09-19 at 12.14.58 PM.png

Robert-H
Tourist
10 0 1

When i try to create a market-metafield, i only got this useless error-message  😞

Um diese Definition zu speichern, muss 1 Änderung vorgenommen werden:

Beim Versuch, eine Metafeld-Definition zu erstellen, ist ein unbekannter Fehler aufgetreten



RobertH_0-1698246193707.png


Does anyone know, what i do wrong here? I am not adding this field as admin, but i was able to create other metafields for products and categories with my account. Could the problem be, that only admins can edit markets, and though only admins could add market-metafields? 

ManuelWirtz_de
Shopify Partner
6 0 2

thank you very much for taking the time to post this info. it helps me a lot

Shopify Partner

Build Shopify online stores
Optimization of Shopify online stores to increase sales
Conversion rate optimization
Shopify frontend coding
Shopify troubleshooting