> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://regiostech.crisp.help/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Incorrect Shipping Costs in Order Confirmation Emails

If your order notification emails are displaying incorrect shipping values when using a shipping discount from our app, the most likely reason is that your order notification template has subtle issues in its Liquid code.

Go to **Settings > Notifications > Customer notifications > Order confirmation**, click **Edit code**, and make the following changes if necessary (we recommend saving a backup copy first):

## Calculate Discounted Shipping Price Before Displaying
If your template simply displays `{{ shipping_price | money }}`, it might not include discounts.

Here's a Liquid snippet you can use to calculate a `discounted_shipping_price` variable:

```liquid
{% assign order_discount_count = 0 %}
{% assign total_order_discount_amount = 0 %}
{% assign subtotal_order_amount = 0 %}
{% assign has_shipping_discount = false %}

{% for discount_application in discount_applications %}
  {% if discount_application.target_selection == 'all' and discount_application.target_type == 'line_item' %}
    {% assign order_discount_count = order_discount_count | plus: 1 %}
    {% assign total_order_discount_amount = total_order_discount_amount | plus: discount_application.total_allocated_amount  %}
    {% assign subtotal_order_amount = subtotal_order_amount | plus: discount_application.total_allocated_amount  %}
  {% endif %}
  {% if discount_application.target_type == 'shipping_line' and discount_application.total_allocated_amount > 0 %}
    {% assign has_shipping_discount = true %}
    {% assign shipping_discount = discount_application.title %}
    {% assign shipping_amount = discount_application.total_allocated_amount %}
    {% assign subtotal_order_amount = subtotal_order_amount | plus: discount_application.total_allocated_amount  %}
    {% assign discounted_shipping_price = shipping_price | minus: shipping_amount %}
  {% endif %}
{% endfor %}
```

## Other Suggestions
Please take a look at this article, which addresses similar issues, but with draft order invoice templates:

[Incorrect Shipping Costs in Draft Order Invoices](/en/article/incorrect-shipping-costs-in-draft-order-invoices-19cnit1/)