Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
I've been trying to access a JSON typed metafield from a Product, via the Order Printer app, using a new template. I can output the JSON as a string, but I cannot, whatever I try, access the JSON as an object.
This will output the string of the JSON object:
{% for line_item in line_items %}
{% assign product_pkgs = line_item.product.metafields.packages.value %}
{{ product_pkgs }}
{% endfor %}
If I use the JSON filter I receive output: "Liquid error: internal"
{ product_pkgs | json }}
If I shared everything I have tried, this post would be much too long. I have contacted Shopify Support about 10 days ago who while they tried to be helpful ultimately I haven't heard back from them after they said they would take the issue to their backend support team.
Any ideas?
I'm thinking I might need to resort to accessing the JSON string via JavaScript and render the invoice that way, using whatever client libraries are available. I hope not...
I know this is not a straight answer but we did this recently for a customer on Pixi Order Printer
I'm the developer of this app. I would recommend you give this app a spin. If you install this app and contact us via support we can do this part for you 🙂
We have a unique approach to writing templates. It is very similar to building sharable Shopify themes.