Developer forum

Forum » Ecommerce - Standard features » Ecom:Product.Discount.Price.PriceWithVAT not behaving the same in 2 scenarios

Ecom:Product.Discount.Price.PriceWithVAT not behaving the same in 2 scenarios

Jacob Storgaard Jensen
Reply

Hi,

I've got an issue where a discount activated with a voucher/promo code isn't affecting Ecom:Product.Discount.Price.PriceWithVAT the same way as if the exact same discount is set without the voucher/promo code.

A product with a DB price of 149 – when the discount is just ON without the use of promocode the value of the Discount tag is 134,10 - BUT activated by the voucher it is still 149... But the order line total and the order total is reflecting the correct discounted prices.

Is this intended behaviour or a bug?

Solution is running 9.3.8 (and not that easely upgraded)


Replies

 
Nicolai Pedersen
Reply

Hi Jacob

If a user enters the product from i.e. Google and has no cart - what is the price of the product? He has not yet entered the promocode... So how would DW know that this is a (possibly) discount? If only some users got the discount?

The thing is, that the cart needs that promocode added before the discount is valid - and before it is, there is no discount.

So, on the product, you have a loop of discounts - either ProductDiscounts or AllDiscounts that might help you. With those, you can write out what discount might be available at a later stage...

Hope this makes sense, Nicolai

 
Jacob Storgaard Jensen
Reply

SORRRY Forgot to mention - I'm in the Cart and in the OrderLines loop.

And the problem (as I see it) is that when the voucher code is activated the orderline unit price is not affected - only the total. There is no field/tag saying what the orderline unit price actually is after the discount is applied... (Before and after price)


The ProductDiscounts and AllDiscounts loops are empty when I'm in the OrderLines loop

 
Nicolai Pedersen
Reply

Hi Jacob

You have to set the "Apply as" setting to Orderline discount, see dump.

BR Nicolai

Capture.PNG
 
Jacob Storgaard Jensen
Reply

It is like that already ;-)

 
Nicolai Pedersen
Reply

For me it looks like this...

Capture.PNG
 
Jacob Storgaard Jensen
Reply

Hi Nicolai,
could you for the speed of debugging try and output Ecom:Product.Discount.Price.PriceWithVAT on your orderlines.
Then look at the value when the discount is activated by voucher code. Then turn off the voucher code (set to "none" on the discount) - Then reload your cart... do you get the same value in both rounds?

Otherwise I'll have to setup a new local rapido with voucher stuff  :-)

 
Nicolai Pedersen
Reply

Nope, but you are very welcome to download and install Rapido and do it on that solution :-).

 
Jacob Storgaard Jensen
Reply

Will do when the time is available – we'll leave it there for the time being, solved it with a little math instead.

 
Jacob Storgaard Jensen
Reply

Okay, couldn't help myself...
Just tested on 9.4.15

The field Ecom:Product.Discount.Price.PriceWithVAT has (in my oppinion) a wrong behavior in the cart OrderLines loop - when an Order line discount is applied via a voucher code.

Lets say I have a product with a price of 1000

When a 10% discount is applied without the use of a voucher code the field Ecom:Product.Discount.Price.PriceWithVAT correctly outputs 900

Then, when using the exact same discount, but using a voucher code to trigger it, the field Ecom:Product.Discount.Price.PriceWithVAT outputs 1000

There shouldn't be any output difference in those two scenarios...

 
Nicolai Pedersen
Reply

Hi Jacob

You use the Product.Discount.Price. And since the discount with the voucher code is related to the order (and not the product), the price of the product it self is not affected - only the price of the orderline. The difference is suddle, agreed, but it is there.

In the cart, use the Ecom:Order:OrderLine.TotalPrice tag instead.

You have a stack that looks like this:

  1. The product has a price
  2. The product has a discount
  3. The orderline has a price
  4. The orderline has a discount
  5. The order has a price
  6. The order has a discount

So in theory, you could have 3 discounts - one in each level that combined will give you the total order value including of course the qty.

BR Nicolai

 
Jacob Storgaard Jensen
Reply

I might not be clear on what I try to achieve here...

This only concerns Orderline Discount (Exclusive) - not Order Discounts inclusive/exclusive.
I'm trying to show the after- and before-prices as shown in the attached image, and not show the orderline discounts as their own rows, but the effect they have on the orderline itself. As of now the orderline total is fine and shows the total discount for that line. But when an orderline discount is applied with a voucher I have no tag giving me the discounted price of one unit of that orderline.
The goal is to show the prices on an orderline in the cart like this: Unit discounted price Unit normal price

As I see it a orderline discount can be set to only be valid for one ore more product(s), activating it with a voucher code doesn't make it less orderline(product) specific... So as I said, the discount I've made is product/orderline specific, but activated on the order when entering a voucher code.

I fully understand that there is a slight difference to the Product.Discount.Price tag in the two scenarios, but I still feel that triggering the exact same orderline discount just via a voucher code, should have a tag outputting the discounted unit price on the affected orderline since it is an orderline discount... something along the way of Ecom:Order.OrderLine.UnitDiscountPrice, which should give me the same discounted price in both scenarios, voucher activated or not...

Is it totally "mental" what I'm saying here? :-)

P.S. As mentioned earlier, I've got it working doing a little math in razor, but when I feel I'm right I don't let it go that easily ;-)


 

Bitmap.png

 

You must be logged in to post in the forum