Can someone share how I might add a variant metafield to a printed receipt as a line item?
If the namespace and key is ‘custom.location’, what would be the code I’d use?
Can someone share how I might add a variant metafield to a printed receipt as a line item?
If the namespace and key is ‘custom.location’, what would be the code I’d use?
Hello @NDJAU ,
Try this
{% for line_item in transaction.line_items %}
{{ line_item.product.title }} - {{ line_item.variant.title }}
Quantity: {{ line_item.quantity }}
Price: {{ line_item.price | money }}
{% assign metafield_value = line_item.variant.metafields.custom.location %}
{% if metafield_value %}
Additional Info: {{ metafield_value.value }}
{% endif %}
{% endfor %}
If problem solved don’t forget to Like it and Mark it as Solution!
And if you need help with customization/code part you can contact me for services
You can find the email in the signature below.
Thanks
Thanks - would this go in the code editor under the line-items.liquid section?