Hey, i want to display a part of the follow JSON String in the Metafield attached:
I want to include only the part behind “Bin”. In this case its “Ladenlokal - Leere OVP hinter Kasse”.
I already now how to integrate the sku in the product-template.liquid with this code but i dont know what i have to change:
**Unsere interne Artikelnummer: {{ current_variant.sku }}**
Seems like you needs to make 2 steps:
1 - Getting necessary metafield by namespace and value
It can be:
{{ current_variant.metafields.iPacky.iPackyData }}
where iPacky - metafields namespace, iPackyData - metafield name.
2 - Getting necessary value from json object.
The full result can be visible like
{% for property in current_variant.metafields.iPacky.iPackyData.value -%}
{% if property.first == 'Bins' %}
{% assign bin = property.last | first }}
{{ bin.Bin }}
{% endif %}
{%- endfor %}
There is some materials about how it works:
Shopify metafields documentation: https://shopify.dev/api/liquid/objects#metafield
Guide how to show item from json array: https://markinternaut.com/how-to-display-json-format-product-metafield-in-shopify-2-0/
Could you may help again? It was working fine but now it didnt.
You might need to double-check data into metafield.
Perhaps “Bins” object is empty or this field isn’t available for this product or page.
I don’t think that Shoipify changed smt on their side.