How do I retrieve the unit price of each line item in a Shopify order (before and after discounts)?

There's a field called line_items.price which is the unit price of each item ordered before any discounts have been applied. For the line item's total price (unit price x quantity), you can use the field line_items.total_price.

There's also a field called line_items.discount_allocations.total_amount which is the total discounts applied to the total quantity ordered of each line item. So if you need to calculate the unit price of each item after the discounts, you can subtract this value from line_items.total_price and divide the difference by the ordered quantity.

You can use the formula below in the Calculated Fields section in the Data Settings of EZ Exporter to get this value:

({{ line_items.total_price }} - {{ line_items.discount_allocations.total_amount }}) / {{ line_items.quantity }}

App: EZ Exporter

Tags: faq, advanced features