Skip to content

Instantly share code, notes, and snippets.

@baorv
Last active May 28, 2020 03:07
Show Gist options
  • Save baorv/6f97240b782772d7d95f7f3a38b189f0 to your computer and use it in GitHub Desktop.
Save baorv/6f97240b782772d7d95f7f3a38b189f0 to your computer and use it in GitHub Desktop.
{% assign totalRemoveItemPrice = 0 %}
{% assign removeItems = "" %}
{% for refundItem in order.refunds %}
{% for refundLineItem in refundItem.refund_line_items %}
{% assign totalRemoveItemPrice = totalRemoveItemPrice | plus: refundLineItem.subtotal %}
{% assign removeItems = removeItems | append: refundLineItem.line_item_id | append: ", " %}
{% endfor %}
{% endfor %}
{% for item in order.line_items %}
{% if removeItems contains item.id %}
{% continue %}
{% else %}
{% endfor %}
{{ order.subtotal_price | minus: totalRemoveItemPrice | money: order.currency }}
{{ order.total_price | minus: totalRemoveItemPrice | money: order.currency }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment