Skip to content

Commit

Permalink
adding discount allocation to shipping lines
Browse files Browse the repository at this point in the history
  • Loading branch information
“aaron.hagan” committed Jul 28, 2023
1 parent 7d77a38 commit 9990cd6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions models/shopify__order_shipping_lines.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,20 @@ with shipping_order_lines as (

), discount_allocation as (

select *
select
order_line_id,
source_relation,
SUM(amount) AS discount_amount
from {{ var('shopify_discount_allocation') }}
group by order_line_id, source_relation

),
joined as (

select
shipping_order_lines.*,
tax_lines_aggregated.order_line_tax,
discount_allocation.amount AS order_line_discount_allocation
discount_allocation.discount_amount AS order_line_discount_allocation

from shipping_order_lines
left join tax_lines_aggregated
Expand Down

0 comments on commit 9990cd6

Please sign in to comment.