Shopify themes, liquid, logos, and UX
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 %}
<table>
<tr>
<th>License ID</th>
<th>Product</th>
<th>Expiry Date</th>
</tr>
{% for license in licenses %}
<tr>
<td>{{ license.license_id }}</td>
<td>{{ license.product_name }}</td>
<td>{{ license.expiry_date }}</td>
</tr>
{% endfor %}
</table>
{% else %}
<p>No licenses found.</p>
{% endif %}
Solved! Go to the solution
This is an accepted solution.
Never mind !! Just add ".value" to "purchased_license_record" then I should be fine 🙂
This is an accepted solution.
Never mind !! Just add ".value" to "purchased_license_record" then I should be fine 🙂
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025