Product Metafield using Shopify Liquid in Theme's Default Content

Product Metafield using Shopify Liquid in Theme's Default Content

anupamdeoarya
Visitor
2 0 1

Hello, 

 

I am trying to display a metafield value as the default content on the product page. 

 

This is the syntax, I am using:

anupamdeoarya_3-1731585405507.png

 

 

The metafield definition is as follows:

anupamdeoarya_1-1731585311541.png

 

But when I enable it on the theme, it does not show the value. What could I be missing here ???

 

anupamdeoarya_2-1731585366785.png

 

 

Replies 2 (2)

tim
Shopify Partner
4455 530 1629

No, it does not work like this.

 

In default theme content (previously Theme Language) {{variable}} is not a way to render Liquid variable, but a placeholder for a variable which will be supplied by a theme code.

 

Say you have a translation called "Quantity of color" under General and it's set as "{{ number }} of this color available"

 

When your liquid code in theme looks like {{ "general.quantity_of_colors" | t: number: 25 }} the system will output "25 of this color available"

 

Documentation is here https://shopify.dev/docs/storefronts/themes/architecture/locales/storefront-locale-files#pass-multip... 

If my post is helpful, hit the thumb up button -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com
anupamdeoarya
Visitor
2 0 1

Oh thanks for the explain. So could you help me with the code/syntax that I can define in the theme code so that I can display a metafield value on the product page for a default content/language?