I’ve been trying to figure out how to access a metafield of metaobject reference list type that has a namespace with reserved prefix in a theme app extension in Liquid. The metafield has the namespace $app:product_options and key product_options with type list.metaobject_reference.
This is my code in Liquid:
{% for option in product['$app:product_options'].product_options.value %}
{{ option | json }}
{% endfor %}
This does not print anything.
I’ve confirmed that the metafield and the referenced metaobjects are on the product I’m looking at in the local development instance of the storefront, and the code app works (e.g., I can print the ID of the product).
I’ve tried:
- Setting the
storefrontaccess of the metaobjects toPUBLIC_READand the metafields’adminaccess toPUBLIC_READas well. - Using just the key without the namespace on the
product.metafieldsobject.
Accessing the metaobjects directly from shop.metaobjects works by using the fully expanded name of the namespace (i.e. using shop.metaobjects['app--12345678912--product_option']['app--12345678912--product-option-abcde123']), however, this does not work for metafields (i.e., `
product.metafields[‘app–12345678912–product_options’][‘product_options’] does not print anything).
Is there a way to access a metafield with reserved-prefixed namespace in Liquid? And if so, how and with what access control options?
Thank for your help.