Warning! Major Money Loser in Discounts

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
I created a discount for 50% off (with a coupon code)

To my astonishment and of course after submitted orders, I found out that the 50% is taken off the total cost of the Old Price of the product, and shipping. (My conclusion comes from anaylising the shopping cart math - not code.)

For instance... the product is Shoes1.

Shoes1 costs 110.00 usd.  Shipping is 10.00 usd.

Shoes is discounted with Price at 70.00 usd.

The total discount in the cart is $60.00!!!  That means my item is selling for $10.00 and I'm losing money!

That is because 110 + 10 = 120 / 2 = $60.

The correct amount should be a discount of $35 and an order total of $45.00 (not $20 like it is currently).

This needs to be fixed imediately...

Can someone please tell me where the code logic is for the Discounts so that I may fix it to what it should be?
13 years ago
What is your discount type? What are your product price and old price?
13 years ago
OK...
     Discount Type:  "Assigned to order total"
     Product Price:  “$70.00”
     Old Price:  “$110.00”

Extra…
     Discount requirement:  “Had spent x.xx amount”
     Required spent amount:  “50”

Note:  I was under the impression, until I read the guide and played with it for a while, that the requirement was for the amount currently in the shopping cart.  So I thought that if the customer was spending $50.00 or more then the discount would apply.  If the shopping cart was less, then the discount wouldn’t apply.  

The guide says that the requirement is for customers that had spent over x amount in a previous transaction.  I’m not so sure that is the case as the discount seems to apply even for anonymous checkout.  I currently have the 1.7 guide and did not see this change in the notes for 1.8 which I am currently running.
13 years ago
I was not able to reproduce this issue. Here is was I see - http://img602.imageshack.us/img602/3743/discount.jpg. It works fine. BTW, if you want to apply discount to a product variant only, then you need to set its type to 'Assigned to product variants' and assign it to this product variant on product variant details page ('Discounts' tab).


Regarding '...the discount seems to apply even for anonymous checkout'. Guest session is stored in cookies (on a certain computer) and is used for the further purchases. If you want to change this behaviour, then you need to modify Discount.CheckDiscountRequirements() method. Replace
 case DiscountRequirementEnum.HadSpentAmount:
                    {
                        if (customer != null)
                        {

with
 case DiscountRequirementEnum.HadSpentAmount:
                    {
                        if (customer != null && !customer.IsGuest)
                        {

P.S. It'll be fixed in the next release
13 years ago
Thanks Andrei for the reply.  I wish there wasn't such a time difference because I would have posted this sooner.

Last night, I played more with the discounts and studied the database a bit more.  I set all of my productvariant.price to the same as productvariant.oldprice.

I then went to another computer and placed a random item into the shopping cart (to bypass any caching or cookies).  Without applying any codes, checkout as anonymous, and getting to the payment page - the product was still discounted more than 50%.

It would seem that my initial thought that it was the oldprice being used is not correct.

Considering that I did not apply any coupon code, it can not be within the discount logic at all.

So why is my shopping cart automatically discounting everything at more than 50%?

I am posting images of my results to show a clearer picture (yes I know its a pun):
  Here is an image of the shopping cart before checkout:  http://brettspencer.name/Nop_Pics/ordersummary.png
  Here is an image of the payment page with full discount applied:  http://brettspencer.name/Nop_Pics/checkoutpaymentmethod.png
  Here is an image of the list of discounts available:  http://brettspencer.name/discountlist.png

If I find the cause of this before someone points me in the right direction... I will share it here so others can make sure it doesn't happen to them.
13 years ago
Andrei, I just studied the image that you submitted (http://img602.imageshack.us/img602/3743/discount.jpg).
If you applied a 50% coupon then the price is NOT correct.

50% of $70 is $35.  So the total should be $35 plus shipping for a total of $45.00 - not $40!

Did you, indeed, apply a 50% coupon code?
13 years ago
Here is the fix to the broken link of the discountlist above:  http://brettspencer.name/Nop_Pics/discountlist.png
13 years ago
hrdfsique wrote:
Andrei, I just studied the image that you submitted (http://img602.imageshack.us/img602/3743/discount.jpg).
If you applied a 50% coupon then the price is NOT correct.

50% of $70 is $35.  So the total should be $35 plus shipping for a total of $45.00 - not $40!

Did you, indeed, apply a 50% coupon code?


You have to include the shipping in your addition.
13 years ago
OK, I have removed all of the discounts (coupons, codes, etc.) from the list.  I used the administration section to manually delete each discount one at a time.

The bug has disappeared.

So that brings up the question... how can a discount be applied to the whole site?

I have reviewed the discount table again and found two discounts missing the LimitationID:

DiscountLimitationID  LimitationTimes  Name
0  1  October Halloween 10% off
10  1  Holiday 50 percent
20  1  Free Product - RED Thigh Highs Reg
20  1  Free Product - RED Thigh High Queen
20  1  10% Off Certain Products
20  1  15% Off Certain Products
20  1  25% Off Certain Products
20  1  30% Off Certain Products
20  1  35% Off Certain Products
0  1  40% Off Certain Products
20  1  45% Off Certain Products
20  1  50% Off Certain Products
20  1  55% Off Certain Products
20  1  60% Off Certain Products
20  1  65% Off Certain Products
20  1  70% Off Certain Products
20  1  75% Off Certain Products

The first one requires a code.  The 40% off does not.  I would guess that the 40% was automatically being applied considering that it doesn't have any limitations.  The problem is that the products where being discounted well over 50%.

OK, I found it...

This is a human error... data entry mistake.

This is a list of of DiscountTypeIDs for above discounts:  #1 = Assigned to order total, #2 = assigned to product variants (SKUs):

DiscountID  DiscountTypeID
1  5
2  1
3  2
4  2
5  2
6  2
7  2
8  1
9  1
10  1
11  1
12  1
13  1
14  1
15  1
16  1
17  1

Ids 5 - 18 should have discount type of 2 NOT 1.

So... be careful when entering discounts as the page defaults to 1 and could apply to the whole store and whole cart.  Make sure you select the correct dropdown before saving.

I double checked this with the 15% off the the whole cart and the discount was correct.

This is a Manual Error - not a code error - BE Careful When Applying Discounts!

Thanks again to Andrei.
13 years ago
deccks,

Thanks for the advice.  If you look again... I did.  BTW how did you use the block as a quote  - is <block> or <quote>...?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.