When you create a order discount and do not assign it a coupon it gets added to all orders.

Coupon export:
{
"name" : "discount_lobster_dinner_coupon2015",
"label" : "Lobster Dinner Coupon2015",
"type" : "order_discount",
"status" : "0",
"component_title" : "cptwentyeight",
"sort_order" : "10",
"commerce_discount_date" : { "und" : [
{
"value" : "1410066000",
"value2" : "1448085600",
"timezone" : "America\/Chicago",
"timezone_db" : "America\/Chicago",
"date_type" : "datestamp"
}
]
},
"commerce_discount_offer" : {
"type" : "fixed_amount",
"commerce_fixed_amount" : { "und" : [
{
"amount" : "2600",
"currency_code" : "USD",
"data" : { "components" : [] }
}
]
},
"commerce_gc_apply" : { "und" : [ { "value" : "0" } ] }
},
"inline_conditions" : { "und" : [
{
"condition_name" : "commerce_order_compare_order_amount",
"condition_settings" : {
"line_item_types" : {
"gift_certificates" : "gift_certificates",
"product" : "product",
"donation_amount" : 0,
"giftcard_use" : 0,
"giftcard_purchase" : 0,
"shipping" : 0,
"registration" : 0
},
"operator" : "\u003E",
"total" : { "amount" : -1, "currency_code" : "USD" },
"condition_logic_operator" : null
},
"condition_negate" : 0
}
]
},
"discount_usage_per_person" : [],
"discount_usage_limit" : [],
"commerce_compatibility_strategy" : { "und" : [ { "value" : "any" } ] },
"commerce_compatibility_selection" : []
}

Comments

markbannister created an issue. See original summary.

joelpittet’s picture

Category: Bug report » Support request
Priority: Critical » Normal
Status: Active » Closed (works as designed)

Maybe you can provide more details but what you are describing is by design. Discounts need conditions for when they are to be applied or of course they would apply all the time.

markbannister’s picture

OK, so maybe a documentation request. I use discounts once a year and had just started setting one up. Created the discount but hadn't gotten around to making the coupons. Nearly gave a few hundred people $28.00 discounts on a non-profit site. Luckily the promotional emails didn't go out on time.
Perhaps the discount should be created disabled by default and a warning message?
It's only obvious that this would happen if you stop and think about how the module is using rules.

joelpittet’s picture

Version: 7.x-1.0-alpha6 » 7.x-1.x-dev
Status: Closed (works as designed) » Active

That sounds unintuitive TBH. "I'm creating this discount AND I need to enable it after for it to work". If you don't use coupons too this is really strange behaviour.

Maybe this is something for the commerce_coupon module to work through?

markbannister’s picture

Maybe this is something for the commerce_coupon module to work through?

OK, maybe you are right, because we you come at this from making a coupon this is not intuitive, in fact it makes people like me have a heart attack and call this a critical bug.
But I'm not sure a warning is not called for.

torgosPizza’s picture

Component: Code » Documentation
Category: Support request » Task

Setting this to a documentation request. I think it'd be easy enough to update the front of the project page with:

NOTE: By default, new discounts are set to Active. Be careful when creating new discounts that apply to all users unconditionally!

Or something to that effect. And perhaps in the new discount creation page you could have a message of sorts as well but honestly I think once you notice this the first time around that's all it takes :) We always set ours up with conditions and/or a coupon code from the start to avoid this type of issue - unless we want the discount to become active immediately!

rszrama’s picture

Title: Discount without coupon added to all cards » Discount without coupon added to all carts

I'll update the project page with instructions and descriptions of discount fields.

rszrama’s picture

Status: Active » Fixed

Aaaaand done.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

akalata’s picture

I know this is already marked as Fixed, and I don't think we want to to re-open -- but will add my notes here for the next searcher.

The confusion comes from using commerce_coupon (2.x) with commerce_discount. My coupon needs to have a discount reference in order to know what it is supposed to do. So I create a discount for it. Is this discount "active" or "disabled"? Well, I want coupons assigned to it to be redeemable, so I'll make it "active". But there are no coupons assigned to it yet, so it's active for everything.

In my case, I'm generating coupons dynamically - so the discount must exist, possibly before any coupons have been created.

My wish would be for the "Coupon conditions" area to be closer to the Order/Product discount conditions area or above the vertical tabs which typically signal the end of an editing form. But I also know that the its current placement could be a technical (module X adding a field to a form defined by module Y) or UX (unlimited list of coupons would be better at the bottom) decision.

joelpittet’s picture

@akalata That UX change sounds reasonable, though it may be that commerce_coupon will have to do that. Could you open an issue with the exact what you wrote in #10 on that queue?

commerce_coupon injects it's fields on the form, so I'm sure it can reposition the conditions closer to the other conditions.

The vertical tabs are really new on this end to help clean up the mess that ends up below.

I share the pain between the UX between the two modules and the dependency that seems quite disjointed at the moment. I'll entertain any idea around UX and help write patches to make the UX better even by an inch;)

joegl’s picture

I believe this commerce_coupon issue is relevant: https://www.drupal.org/project/commerce_coupon/issues/2610376

joegl’s picture

I've added a patch to the above commerce_coupon issue, which adds options to commerce_coupon to:

1. Auto-disable active discounts without active coupons attached
AND/OR
2. Issue a warning when there are active discounts without active coupons attached