How Can I Associate My Shopify Orders With Discounts?
To associate your orders with any discounts applied, you must use a JOIN
operator to combine the ORDER_LINE
table with the DISCOUNT_APPLICATION
and DISCOUNT_ALLOCATION
tables. You can use the following query to associate your orders:
select
*
from
discount_application
JOIN order_line ol ON discount_application.order_id = order_line.order_id
JOIN discount_allocation dal ON order_line.id = discount_allocation.order_line_id