All things Shopify and commerce
If customer orders 4 qty of the same product and request to refund 1 qty, nett qty should be 3 but our template would still display as 4.
Our script is as below. Can anyone help please? Thank you!
<tbody>
{% for line_item in fulfilled_line_items %}
{% unless line_item.quantity == 0 %}
<tr>
<td>{{ line_item.quantity }} x</td>
<td><b>{{ line_item.title }}</b>
{% for property in line_item.properties %}
{% if property.first contains '_io_' %}{% continue %}{% endif %}
{% if property.last == blank %}{% continue %}{% endif %}
<br>{{ property.first }}: {{ property.last }} {% endfor %}
</td>
{% if line_item.tax_lines %}
<td>
{% for tax_line in line_item.tax_lines %}
{{ tax_line.price | money }} {{ tax_line.title }}<br/>
{% endfor %}
</td>
{% endif %}
<td>{{ line_item.sku }}</td>
<td>{{ line_item.price | money }}</td>
</tr>
{% endunless %}
{% endfor %}
</tbody>
@metaterra is this the code from the order confirmation or from the order refund?
The code you are showing, checks for all fulfilled items.
So even if the customers requests a refund, the number of the prior fulfilled items would still be the same.
To update the template so it reflects the net quantity after partial refunds, follow these steps:
Here’s the modified code:
Ensure that refunded_quantity is available in line_item data, or set up a back-end process to track and update this field.
Experience personalized shopping and real-time support with the Debales AI Chatbot on Shopify! Engage customers effortlessly and help them find the right products—let’s chat!
Please let us know if our reply is helpful by giving it a Like or marking it as a Solution!
@VipulBudhiraja Thank you for the suggestion.
How do we ensure that refunded_quantity is available in line_item data, or set up a back-end process to track and update this field?
I've tried replacing the existing code with yours and it doesn't seem to work as yet.
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025