Ad

Customize Order Confirmation Email With Line Item Properties

I'm customizing order confirmation email but when I tried to send line item property, it shows as name and value in one line like this. Width900. I want to show Width: 900 in name: value format.

How can I do this?

{% for line in subtotal_line_items %}
{% for p in line.properties %}
<span>{{ p }}</span><br/>
{% endfor %}
{% endfor %}
Ad

Answer

line.properties will give you a json object. Try this

{% for line in subtotal_line_items %}
{% for p in line.properties %}
<span>{{ p.first }}: {{ p.last }}</span><br/>
{% endfor %}
{% endfor %}
Ad
source: stackoverflow.com
Ad