commerce icon indicating copy to clipboard operation
commerce copied to clipboard

[4.x]: Discount automatically applied to all orders when no coupon code is set

Open samueldraper opened this issue 2 years ago • 6 comments

What happened?

Description

Users automatically seeing coupon codes applied at checkout, and discount applied for which they are not eligible.

Cause seems to be because no coupon code was specified therefore (one of several but not all) discounts were applied to cart.

Steps to reproduce

  1. Create discount rules
  2. Do not add a coupon code

Expected behavior

Should not apply to all carts. Coupon code should be mandatory.

Other info

Based on #3131 this issue is actually expected behaviour. If that is the case a UX enhancement would be much needed in order to avoid the possibility of this happening. Even as simple as some validation: "Are you sure you don't want to add a coupon code? This will result in discount being applied to all carts that meet the criteria".

Craft CMS version

4

Craft Commerce version

4

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

samueldraper avatar Apr 05 '23 14:04 samueldraper

Coupon codes are just a condition for the discount, just like any other condition on the Discount. The feature is Promotions > Discounts, not Promotions > Coupons.

We could make it clearer within the discount edit page, though. This is the first time someone has submitted this as a misunderstanding. I will leave the ticket open and see what I can do.

lukeholder avatar Apr 06 '23 04:04 lukeholder

We've lost almost 1000 Euros due to this misunderstanding. A content manager deleted the coupon code but not the discount itself...

This "feature" is what Sales are supposed to do, it's highly counterintuitive and should probably be behavior that's off by default (on for existing Discounts).

+1 on at least making it clearer on the page that the discount is automatically applied.

The documentation does hint at this behavior, but does not state this specifically as potentially unwanted behavior.

P.S.: Such discounts actually stack.

soulseekah avatar Jul 10 '24 15:07 soulseekah

@lukeholder

This is completely unexpected behaviour, and I see no reason why the coupon code should be automatically applied when no coupon code is generated? Could you give me some real practical examples where it should be used? I accidentally ran into the same issue and I still confused. We lost some money because of it.

We have sales for the automatic discounts, and this is logically they can be applied to any customer. They are even located in a separate section. But I'll be honest, I don't understand at all why a coupon code works as a sale, especially when there is no actual coupon code lol.

Could you please reconsider this behaviour of coupon codes and ,maybe, mark it as a bug? Or perhaps I don't know the reason why it's done in such way.

Either way, thanks for any answer!

Romanavr avatar Jul 10 '24 17:07 Romanavr

Hi all

The functionality in Commerce for discounts and coupon codes has been the same since its inception. If there are no coupons set on the discount the user does not need to enter a discount to potentially be eligible. This is intended functionality as there are many types of discount that do not require a code to be entered, for example spend $100 and get 10% off or buy X number of items and get a discount.

It is obviously disappointing in how things have turn out for your projects. So in a chance to improve the user experience and hopefully attempt to negate the issue of a store manager accidentally removing all coupons we are going to look to implement a new "Requires coupon code" light switch on the coupons tab. This will then have to be enabled to be able to start using the coupons but will also act as a "fail safe" that if the light switch is enabled but there are no coupons (maybe because the have been deleted legitimately or accidentally) we will know that the discount can not be matched to an order.

Thank you for your patience and feedback.

We will keep this issue open and reference it when the new feature is available.

Thanks!

nfourtythree avatar Jul 24 '24 20:07 nfourtythree

Thank you for that. We are really looking forward to this feature in the new release)

Romanavr avatar Jul 24 '24 21:07 Romanavr