[Resolved] Combination discount totals not adding up correctly


  • Default avatar
    brendon0    
     10 years ago
    0

    Our client is running multiple coupons, and in some cases the coupons can be combined. Currently there are automatic order total coupons that give customers 5% off for an order with $250 total, or 10% for an order with $500 total. There is also a "Welcome" coupon that can be used once per customer for 10% off of the order total.

    Each of these coupons seem to work perfectly on their own, but we've noticed some odd math when a customer uses the Welcome coupon with either of the automatic order total coupons. For example, here is a recent order in which the 10% Welcome coupon was combined with an automatic order coupon of 10% because the order total including VAT was over $500:

    Subtotal: 469.92
    Tax: 56.39
    Subtotal + Tax: 526.31
    Discount: 97.63
    Total: 428.68

    By my math the discount total should either be $105.26 if both are being applied simultaneously, or $100.02 if each 10% discount is being applied sequentially.

    If anyone can give me a better idea of how multiple discounts like this are handled at checkout it would be greatly appreciated.
  • Your avatar
    seyi    
     10 years ago
    0

    Hello,

    The are not taken at the same time, one after the other, so should be $100

    Take a look at awocoupon->history of uses, what is the breakdown in discount for that order?
  • Default avatar
    brendon0    
     10 years ago
    0

    Thanks for the quick response.

    It looks like the automatic coupon was taken off first for a discount of 52.63. This is correct then since the order total with tax was 526.31.

    In the history of uses, the Welcome coupon is then applied for a discount of 45.00. This one seems like the anomaly to me. If it's supposed to be deducted from the total after the first coupon has been applied, then (unless I understand you incorrectly) it should be as follows:

    Order total: 526.31
    1st coupon: -52.63
    New order total: 473.68
    2nd coupon: -47.37
    Final total: 426.31

    So I agree with you that it should be a $100 discount after both coupons have been applied, I'm just not sure why the Welcome coupon is showing up as a $45 discount in the history of uses. There are a coupon of other cases like this one as well when the Welcome coupon has been applied in conjunction with an automatic coupon.
  • Your avatar
    seyi    
     10 years ago
    0

    Hello,

    I tested this scenario and not getting the same results, its working fine on my end.

    Looking at the second discount 45/473.68 = 0.09500084...

    Looks like its giving a 9.5% discount. Are you 100% sure the specific welcome coupon used is set to 10%? Can you just look and verify it?
  • Default avatar
    brendon0    
     10 years ago
    0

    I can verify that the Welcome coupon is set to 10% because when it is the only coupon, a 10% discount has correctly been applied to all of the orders with the Welcome coupon in the history of uses. It's only when the Welcome coupon is being combined with the automatic order total coupons that the error is occuring.

    I checked it against another order where both coupons were applied, and it was the same 9.5% discount instead of 10%. The same was true when I just went through checkout before posting this. Here are the details of the order I ran through checkout just before posting this:

    Subtotal: 528.00
    Tax: 63.36
    Subtotal + Tax: 591.36
    Discount: 109.70
    Total: 481.66

    So I'm not sure if you have any ideas as to why that could be happening, but let me know if you need me to do anything further to help isolate the problem.
  • Your avatar
    seyi    
     10 years ago
    0

    Hello,

    Cant produce it so do not know where the difference is coming from. The only thing I can do is debug it. If you have it set up on a dev site that produces the problem, please forward me temp admin and ftp access and I can look at it.
  • Default avatar
    brendon0    
     10 years ago
    0

    Hi Seyi,

    Unfortunately it's not set up on a development site because we only have the one license and it's been made permanent on the live site. If you're able to have a look at it there though that would be great because it's definitely beyond my skill level to debug it. I'll PM you the info you need.

    Cheers,

    Brendon
  • Your avatar
    seyi    
     10 years ago
    0

    Hi Brendon,

    Very complicated issue to find but it is now fixed.

    The problem was the tracking of the discount was done incorrectly for parent coupons of 'highest value' and 'lowest value'. It has to process all the coupons within the parent coupon and give the highest/lowest value. In doing so, it was also tracking the discount for each coupon processed, although it does not actually apply each coupon code. I did not produce this issue because when creating the parent coupon with minimum order total restrictions, I ordered the coupons from highest to lowest and used the 'first found match'.

    In any case, fixed, and will be updated on the next version.
  • Default avatar
    brendon0    
     10 years ago
    0

    Brilliant. I'll mark this topic as resolved and let my client know. Keep up the great work!