Developer forum

Forum » Ecommerce - Standard features » Remove voucher and discount from cart

Remove voucher and discount from cart

Lars Larsen
Lars Larsen
Reply

Hi

I am working on a DW v9.6.9 solution where it should be possible to have this checkout scenario:

  • user adds products to the cart
  • goes to the checkout flow
  • adds a vouchers which triggers a discount
  • user goes to next step in the checkout flow
  • user logs in

After the user has logged in (the user is still in the checkout flow) the system validates the voucher entered earlier in the checkout flow and discovers that the user is not allowed to use this voucher and therefore we need to remove the discount from the cart. Is this possible and how? 

PS. rules for vouchers are in an external system


Replies

 
Nicolai Pedersen
Reply

Custom code it? You can by code remove vouchers from the order - that would trigger a price recalculation and should fix it.

Alternatively change the checkout flow. Login on first step only and then you can proceed. Login on step XYZ is a lot of trouble because of discounts, payments, prices, deliveries etc etc.

BR Nicolai

 

 
Lars Larsen
Lars Larsen
Reply

Hi Nicolai

Yes your'e right about having the user to login at first. But I can't convince our UX'er! I have tried to remove the voucher by code in the BeforeRenderingNewStep notification, but that didn't work. Where in the pipeline should I remove the voucher?

 
Nicolai Pedersen
Reply

I do not know. Ask your UX'er...

 
Lars Larsen
Lars Larsen
Reply

:-D

BTW found out that it's much easier to let the frontend submit an empty value for the voucher field (EcomOrderVoucherCode), this will of cource trigger Dynamicweb to remove the discount.

 

You must be logged in to post in the forum