How to add product meta fields to quick view modal dynamically?

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/1728114

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 }}