Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi Everyone,
I am having an issue when I try to dynamically add product meta fields to the product Quick view modal.
So here is the detailed issue:
{%- assign product_handle = '[[ product.handle ]]' -%} {{product_handle}} {% assign how_to_use = all_products[product_handle].metafields.my_fields.how_to_use %} {{how_to_use}}
In this case, {{product_handle}} returns the correct value: 'oilwater-replenish-nourish-rosehip-mini' but {{how_to_use}} returns an empty value.
Please help me with this problem.
Thank you
Shopify functions are not for liquid issues https://community.shopify.com/c/shopify-functions/not-a-general-shopify-functionality-board/td-p/172...
Use the value property on metafield definitions.
And this code had extra characters in it: [[ & ]]
{%- assign product_handle = '[[ product.handle ]]' -%}
Beyond that you need to confirm spelling of metafields key and namespace.
Then just make output at each level of what is being assigned to validate code.
i.e.
{% assign product = all_products[product_handle] %}
{{ product | json }}
{{ product.metafields.my_fields.how_to_use | json }}
{{ product.metafields.my_fields.how_to_use.value }}
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
In Canada, payment processors, like those that provide payment processing services t...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025