I would to call metafields shopify.country
This correct way to call the value?
{% if product.metafields.shopify.country.value != blank %}
- Grapes
- {{ product.metafields.shopify.country.value }}
I would to call metafields shopify.country
This correct way to call the value?
{% if product.metafields.shopify.country.value != blank %}
Yes, that is the correct syntax.
The format product.metafields.namespace.key.value is the standard way to access a metafield’s value in Liquid. Your code, {{ product.metafields.shopify.country.value }}, follows this structure perfectly.
Using an if statement to check if the value is blank before printing it is also an excellent practice.
Hope this helps!
But some reason, I got this result

That result means your metafield is not a simple text field but a list of metaobject references. To display the value, you need to loop through the list and then access the specific field you want from each object.
You will need to replace item.name with whatever the field key is in your metaobject definition (for example, it could be item.title).
{%- if product.metafields.shopify.country.value -%}
<p>Grapes:</p>
<ul>
{%- for item in product.metafields.shopify.country.value -%}
<li>{{ item.name }}</li>
{%- endfor -%}
</ul>
{%- endif -%}
Let me know how it goes.
Still not working, I think because this metafields direct from shopify? So we can’t call it on block?
Then instead of
<li>{{ item.name }}</li>
try
<li>{{ item.label }}</li>
Can also try:
{{ product.metafields.shopify.country | metafield_text: field: "label" }}
This filter works with metaobject reference lists
Work will, for {{ product.metafields.shopify.country | metafield_text: field: “label” }}
off sitewide
July sale — 45% off at checkout, applied automatically. Valid for 60 minutes. One per customer.
Offer ends in