I am working on the free version of uCommerce and set up my own voucher system, I can manage to get the discount showing up when I insert the right code, but cant get the Purchase Total to recalculate and subtract the money off.
Does anyone know what has to be set here to do this?
Are you executing the basket pipeline after you add the discount to the order? If there's a discount associated either at the order level or at both the order and line level uCommerce will figure in the AmountOff automatically.
I have altered the basket pipelines and created a new class to look for the voucher code from the text field, I changed the Basket.ApplyAwards(I think it was called) and this class is called from there, but from here I cant get the Order Total to recalculate it with the discount added. The order level should be the level after this and it isnt having an effect.
None of this was working automatically. I had to bring in the CalculateOrderTotalTask and hardcode this to take the discount off the Order Total, this was the only way to do it. So I had to rewrite the pipelines and bring in serveral of the classes from the dll to get it to work.
Hi Soren, just joining this thread. I am using uCommerce-3.5.0.13098. I am trying to do a similar thing using the code:
var dis = new Discount { AmountOffTotal = discountValue.Value };
basket.AddDiscount(dis);
basket.Save();
TransactionLibrary.ExecuteBasketPipeline();
After I do basket.Save() I can see the discount listed in the Discounts but after I Execute the BasketPipeline the discounts are removed so not calculated.
I have not customised the Basket Pipeline from the default so it has:
<!-- Calculate order level discount total based on applied discounts -->
<value>${Basket.CalculateOrderLinesUnitDiscounts}</value>
<!-- Calculcate order line discounts based on applied discounts -->
<value>${Basket.CalculateOrderDiscount}</value>
<value>${Basket.CalculateOrderLinesDiscounts}</value>
Discounts in uCommerce
Hi,
I am working on the free version of uCommerce and set up my own voucher system, I can manage to get the discount showing up when I insert the right code, but cant get the Purchase Total to recalculate and subtract the money off.
Does anyone know what has to be set here to do this?
Thanks in advance.
Jason
Are you executing the basket pipeline after you add the discount to the order? If there's a discount associated either at the order level or at both the order and line level uCommerce will figure in the AmountOff automatically.
Soren
I have altered the basket pipelines and created a new class to look for the voucher code from the text field, I changed the Basket.ApplyAwards(I think it was called) and this class is called from there, but from here I cant get the Order Total to recalculate it with the discount added. The order level should be the level after this and it isnt having an effect.
Thanks
Jason
How are you adding the discount?
Something like this?
Hi Soren
None of this was working automatically. I had to bring in the CalculateOrderTotalTask and hardcode this to take the discount off the Order Total, this was the only way to do it. So I had to rewrite the pipelines and bring in serveral of the classes from the dll to get it to work.
All working now though.
Thanks
Jason
The basket pipeline should take the discounts into account when recalculating.
Which version are you on?
Hi Soren, just joining this thread. I am using uCommerce-3.5.0.13098. I am trying to do a similar thing using the code:
After I do basket.Save() I can see the discount listed in the Discounts but after I Execute the BasketPipeline the discounts are removed so not calculated.
I have not customised the Basket Pipeline from the default so it has:
Actually I just solved it using your tip from here: http://our.umbraco.org/projects/website-utilities/ucommerce/ucommerce-support/24893-Apply-voucher-code-programatically . Commented out the <value>${Basket.ApplyAwards}</value> from the pipeline and its all great!
is working on a reply...