Why Does the pre_tax_price Column in the ORDER_LINE Table Contain null Values?
Question
Why does the pre_tax_price column in the ORDER_LINE table contain null values?
Environment
Connector: Shopify
Answer
The Shopify API no longer includes the pre_tax_price field in responses, and we have deprecated the corresponding column. As a result, you may see null values in your destination. For more information, see our Shopify release notes.
However, you can calculate a similar value by subtracting allocated discounts from the line item's total price using the example query below:
SELECT
ol.id as order_line_id,
ol.price,
discounts.total_discount,
ol.pre_tax_price,
(ol.quantity * ol.price) - discounts.total_discount AS calculated_pre_tax
FROM
shopify.order_line AS ol
INNER JOIN
(
-- Subquery to calculate total discounts per order line
SELECT
order_line_id,
SUM(amount) AS total_discount
FROM shopify.discount_allocation
GROUP BY order_line_id
) AS discounts ON ol.id = discounts.order_line_id
LIMIT 10;