Metafield in liquid shows json

Solved

Metafield in liquid shows json

Issyeissue
Excursionist
27 0 7

I am trying to display the metafield with the namespace and key: custom.model_size on my product page on several different places. However everywhere i try to implement it by using several different codes like: 

 

{% if product.metafields.custom.model_size %}
<div class="model-size">
<p>{{ product.metafields.custom.model_size }}</p>
</div>
{%- endif -%}

 

 

=it shows something like the json structure: {"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Model: 172cm/5'7.7\" and wears size S"}]}]} 

 

 

Accepted Solution (1)

Moeed
Shopify Partner
7693 2069 2550

This is an accepted solution.

Hey @Issyeissue 

 

Replace your code with the code below, it will be good to go then

{% if product.metafields.custom.model_size %}
<div class="model-size">
<p>{{ product.metafields.custom.model_size | metafield_tag }}</p>
</div>
{%- endif -%}

 

If I managed to help you then, don't forget to Like it and Mark it as Solution!

 

Best Regards,
Moeed

- Need a Shopify Specialist? Chat on WhatsApp

- Get a quick Shopify quote – Click here!

- Custom Design | Advanced Coding | Store Modifications


View solution in original post

Reply 1 (1)

Moeed
Shopify Partner
7693 2069 2550

This is an accepted solution.

Hey @Issyeissue 

 

Replace your code with the code below, it will be good to go then

{% if product.metafields.custom.model_size %}
<div class="model-size">
<p>{{ product.metafields.custom.model_size | metafield_tag }}</p>
</div>
{%- endif -%}

 

If I managed to help you then, don't forget to Like it and Mark it as Solution!

 

Best Regards,
Moeed

- Need a Shopify Specialist? Chat on WhatsApp

- Get a quick Shopify quote – Click here!

- Custom Design | Advanced Coding | Store Modifications