Show market metafield on product page

Solved

Show market metafield on product page

Fabik1
Tourist
7 0 1

I have created a meta field in Shopify, a "market metafield definition" to be precise.


The namespace and key is custom.add_to_cart_button_fact

I would like to display this variable on the product page and add it to the .liquid file.

What must the variable be so that it is displayed? I tried 

 

 

 

 

{{ product.metafields.custom.add_to_cart_button_fact }}

 

 

 

 

 But just blank space was shown.

Of course I gave the variable a text input inside all Shopify markets.

Accepted Solution (1)
Guleria
Shopify Partner
3944 791 1120

This is an accepted solution.

Please use 
{{ localization.market.metafields.custom.add_to_cart_button_fact }}

It will work.

- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder

View solution in original post

Replies 7 (7)

Guleria
Shopify Partner
3944 791 1120

  It's correct.

 btw try with value 
{{ product.metafields.custom.add_to_cart_button_fact.value }}  
 
 
- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder
Fabik1
Tourist
7 0 1

Thanks Guleria for your kind response, but I still get just a blank space.

Maybe the issue is somewhere else. I put the code into the liquid file.
Bildschirmfoto 2024-07-15 um 15.49.49.png

The liquid file is inserted by the command {%- render 'customer-box' -%} via a custom liquid with the theme editor.
Bildschirmfoto 2024-07-15 um 15.55.18.png

So far it is working with just HTML, but not with {{ product.metafields.custom.add_to_cart_button_fact.value }}  or {{ product.metafields.custom.add_to_cart_button_fact }}  

Guleria
Shopify Partner
3944 791 1120

1) Are you using it in the product page or somewhere else ?

2) Instead of this {%- render 'customer-box' -%} try to use  {{ product.metafields.custom.add_to_cart_button_fact.value }}  or {{ product.metafields.custom.add_to_cart_button_fact }}   in the same liquid block and let me know but make sure you are in the product template. 

 

- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder
Fabik1
Tourist
7 0 1

1) I am using it on product pages, I did a triple-check. I have several different product templates, but I made sure I am opening the correct product with the corresponding product template.

2) I tried both {{ product.metafields.custom.add_to_cart_button_fact.value }} and {{ product.metafields.custom.add_to_cart_button_fact }} in the same liquid block, but still empty although I have an input (see screenshot).

 

Bildschirmfoto 2024-07-15 um 16.26.08.png

Guleria
Shopify Partner
3944 791 1120

 

Sounds like shopify provides a different dashboard to you lol 
btw if you want you can provide the store access so I can check and let you know what is wrong there.

 

- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder
Guleria
Shopify Partner
3944 791 1120

This is an accepted solution.

Please use 
{{ localization.market.metafields.custom.add_to_cart_button_fact }}

It will work.

- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder
Fabik1
Tourist
7 0 1

It works! Thank you so much! 👏