Hello,
I am trying to print out values from a JSON metafield but it does not work:
-JSON Schema :
{> “type”: “array”,> “items”: {> “type”: “object”,> “properties”: {> “license_id”: {> “type”: “string”,> “description”: “Unique ID of the license”> },> “product_name”: {> “type”: “string”,> “description”: “The name of the purchased product”> },> “expiry_date”: {> “type”: “string”,> “format”: “date”,> “description”: “The expiration date of the license (YYYY-MM-DD)”> }> },> “required”: [> “license_id”,> “product_name”,> “expiry_date”> ]> }> }
-Customer JSON values:
[> {> “license_id”: “12345”,> “product_name”: “Luminary Loud Pro”,> “expiry_date”: “2026-01-01”> },> {> “license_id”: “67890”,> “product_name”: “Luminary Loud Enterprise”,> “expiry_date”: “2027-05-15”> }> ]
Liquid :
{% assign licenses = customer.metafields.custom.purchased_license_record %}> > {% if licenses != blank %}> > > > > > > {% for license in licenses %}> > > > > > {% endfor %}>
| License ID | Product | Expiry Date |
|---|---|---|
| {{ license.license_id }} | {{ license.product_name }} | {{ license.expiry_date }} |
{% else %}>
No licenses found.
{% endif %}