cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate coupon discount without applying it to the cart

How to calculate coupon discount without applying it to the cart

I'm trying to see if anybody knows if it's possible to obtain coupon discounts without putting the whole cart through collectTotals() and subsequently the sales rule validator.

 

What I'm trying to do is compare the coupon discount versus the special price discount and apply only one discount to the product in the cart.

3 REPLIES 3

Re: How to calculate coupon discount without applying it to the cart

Lake, I'm just wanting to make sure I understand your question first. So what your talking about is something outside of the general system generated Promotions > Catalog Price > Rules> Rule Information > Conditions? 

 

If that's the case then I'm not aware of a simple fix that could not be better achieved using an extension. Have you checked over on 

Magento Connect for an existing extension? 

Re: How to calculate coupon discount without applying it to the cart

markdh1, I updated my post slightly. The wording wasn't too clear.

 

What I was trying to do is figure out the discount amount a coupon would give for a given product without actually applying it (see original post for more detail). I don't think this is possible without putting together a custom method or without running collectTotals().

 

Re: How to calculate coupon discount without applying it to the cart

Hi @laketuna 

 

This wont be a pretty implementation, but what I think you need to do to do this is check ahead if a before the discounts get applied if a special price is set. You can see this by checking the difference between the getFinalPrice and getPrice on the product object. However doing this can be resource intensive call, so watch out for this.

 

Hopefully this will help you along :-)