How do I export the total of all line item discounts in the order?

When an "Automatic Discount" is applied to specific line items in the Shopify order, the discount information is stored in the field called line_items.discount_allocations.

There's a pre-computed field in EZ Exporter called line_items.discount_allocations.total_amount that will provide you the total discount amount applied to each line item in the order.

In case you need to export the total amount of all line item discounts for the entire order, you can use the formula below:

get_total([i.amount for i in load_json_data(flatten_list(get_attribute_value({{ line_items }}, "discount_allocations", return_raw_results=True)))])

Related Articles:


App: EZ Exporter

Tags: advanced features, discounts, shopify orders, calculated fields