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_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 %}
Joe Pichardo | Shopify Developer

About Joe Pichardo

Joe Pichardo is a Shopify Developer creating themes and apps to help other programmers succeed on the ecommerce platform.

Having trouble? Ask for help.