- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
Hi
I have a more generic issue where the Product revenue(sum of products*qty) in GA is higher than the order revenue(subtotal+shipping+tax).Upon digging in found that order level discounts are not being applied to product revenue
My main priority isto divide the order revenue proportionately between the products at unit level and pass the discounted product revenue.Is there a standard way of doing this .I will be using javascript extension in tealium and not sure on how to divide this to the exact proportions on unit product price
example
s.no item unitprice qty total
1 xx 50 4 200
2 xy 6 2 12
---------------------------------------------------
subtotal: 212
order-level discount: 25
tax: 3
shipping: 20
revennue: 210
Solved! Go to Solution.
Hi @Anonymous
Depending on how you actually want to go about doing this, you can override the values set by the E-Commerce Extension. So options include:
b._ctotal
)Regards,
Adrian
@Anonymous
So the issue you have with JS is decimal places. As soon as you start dividing by odd numbers you'll get numbers like 9.659999999999998 which will then cause discrepancies further down.
If you wanted to apply to the product prices I would first set up a variable with the amount of discount to apply to each item:
var discountToApply = Math.trunc(discount / product_prices.length) ;
var remainingDiscout = discount - (discountToApply * product_prices.length)
Then a for loop that would minus that amount from each product. After the loop, you will need to subtract the remaining discount from one of the product prices.
This will give you the discount unit price for each item.
Adrian
Copyright All Rights Reserved © 2008-2023