Advanced 1 min read

Adding the correct shipping price with discounts

Use correct_shipping_price variable for your shipping. This takes into account the discount adjusted price for shipping when it's discounted using Shopify scripts. `{% if requires_shipping %}` {% assign complete_line_it...

By Joe Pichardo

Use correct_shipping_price variable for your shipping. This takes into account the discount adjusted price for shipping when it’s discounted using Shopify scripts.

{% if requires_shipping %}
{% assign complete_line_item_discounts = 0 %}
{% for line in subtotal_line_items %}
{% if line.original_line_price != line.final_line_price %}
{% assign temp_discount = line.final_line_price | minus: line.original_line_price %}
{% assign complete_line_item_discounts = complete_line_item_discounts | plus: temp_discount %}
{% endif %}
{% endfor %}
{% assign shipping_discounts = total_discounts | plus: complete_line_item_discounts %}
{% assign correct_shipping_price = shipping_price | minus: shipping_discounts %}
{% endif %}

Discussion

Loading comments...