[Feature Request] Data / Metafields for specific options

11 0 2

We have slightly complex product options in our Shopify store. It would be useful to be able to have a product_option.description (that allows for a rich text editor) that could easily be referenced in this object https://shopify.dev/api/liquid/objects/product_option 

Would this be useful for anyone else? 

Replies 2 (2)
11 0 2

By the way, if someone is looking for a workaround in the meantime. 

I used 

{% capture image_loop %}{{product_option.name | remove: " " | downcase | prepend: 'image_'}}{{forloop.index}}{% endcapture %}

To tie my product_option.name with the forloop.index. (ex. color1, color2, color3) 

Then referenced it as so 

<img class="package-options_element-image" src="{{block.settings[image_loop] | img_url: '200x200' | crop: 'center' }}">

and added 

"type": "image_picker",
"id": "image_color1",
"label": "Color 1 Image"
"type": "image_picker",
"id": "image_color2",
"label": "Color 2 Image"

to my schema. The same could be done with HTML, text, etc. It's just not very clean

Shopify Partner
1985 330 405

Hi @Arvanitas,

product_option object only supports these, if you want to use Metafields you need to change the code to variants.

{%- for variant in product.variants -%}
    {{ variant.metafields.my_fields.key }}
{%- endfor -%}

Hope it is clear to you.

LitExtension - #1 Shopping Cart Migration Expert
If our answer is helpful then please accept as solution!
Are you looking for a solution to migrate to Shopify? Contact us for further assistance.
Try our FREE DEMO now!