0
votes

In Shopify I am declaring a variable like this:

{% assign favourites = hello %}

Instead of the variable being `hello, I want to use a metafield from my product. I can get the metafield like this:

{{ product.metafields.global["other_options"] }}

I can't, however, merge the two together like this

 {% assign favourites = {{ product.metafields.global["other_options"] }} %}

I have tried wrapping the liquid object in single and double quotation marks but this doesn't work.

Is it possible to do this?

1

1 Answers

2
votes

Remove the internal braces :)

{% assign favourites = product.metafields.global["other_options"] %}