Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Are coupon expirations and relationships on the roadmap? It would be great to be able to have them expire after a campaign period. Additionally, it would be great to be able to limit the coupon to certain products.
Is this in the works or is it possible now via rules?
Comment | File | Size | Author |
---|---|---|---|
#2 | commerce-coupon-expire-1.png | 22.66 KB | jwjoshuawalker |
#2 | commerce-coupon-expire-2.png | 21.51 KB | jwjoshuawalker |
Comments
Comment #1
pcambraLimiting the coupon to certain products => #1377318: Applying coupon to specific product.
Expiration would be a new date field and rules scheduler, I'll try to put together an example
Comment #2
jwjoshuawalker CreditAttribution: jwjoshuawalker commentedSurprisingly easy if you are familiar w/ the new Rules interface.
Screenshots attached.
1) Add date field to Coupon entity
2) Create new rule according to attached picture #2
Comment #3
pcambraComment #4
jonathan_hunt CreditAttribution: jonathan_hunt commentedFYI, I expanded on @drastik's suggestion: added a date field (field_valid_during) to a coupon that included an end date (defining a duration or period). I created two rules coupon validity checking rules: one testing for the start of the period and one testing the end of the period; the message shown for each one can be distinct. Rules pasted below:
and
Perhaps this can go into a coupon docs or recipes page?
Comment #5
pcambraThat'd be awesome!
Feel free to create one and we can link it from the project page, something like "Coupon recipes" or something
Comment #6
jwjoshuawalker CreditAttribution: jwjoshuawalker commentedI'll export mine to provide for this as well.
Comment #7
kadimi CreditAttribution: kadimi commentedThank you for the image, I managed to have both expired and upcoming coupons throw errors, the only problem now is that I have two error messages:
How can I remove the second message.
Help appreciated
Comment #8
jwjoshuawalker CreditAttribution: jwjoshuawalker commented@kadimi
Check in your coupon rules for any actions named: "Show a message on the site".
If the parameter/message details in the action match your message, you can safely delete that action if you wish.
If it's not coming from a rule, I suggest grep'ing for the message (minus any variables in the message) within your sites/all (if you have command-line). That way you could find out which module is throwing it, assuming it's not saved in the DB. (Hopefully a module would not put something like that anywhere other than rules).
Comment #9
berin CreditAttribution: berin commentedThanks.
Comment #10
RKS CreditAttribution: RKS commentedHas this made it into the release or (if no) is it planned to go into a release?
Comment #11
pcambraThere's nothing like this in the roadmap for me, but I'll gladly review a patch if someone wants to contribute this.
As you can see in #4 this is a very features-like thing, adding a date field and taking care of it in rules should be enough for a basic usage.
Comment #12
camdarley CreditAttribution: camdarley commentedI just added a check if the end date is set or not... This should allow to set only a start date:
Comment #13
RKS CreditAttribution: RKS commentedSo if a limited time only coupon is an edge case, what exactly can this module do?
Comment #14
jwjoshuawalker CreditAttribution: jwjoshuawalker commented@RKS
Add 1 field to coupon entity, and 1 rule and you have limited time coupons.
I don't think it's a matter of 'edge case', but for the sake of keeping this module as a customizable coupon toolkit, and not being a bloated 'trying to do everything at once' module.
At least that is my observation, I don't want to speak for the maintainer.
Comment #15
millionleaves CreditAttribution: millionleaves commentedHi @drastik
I appreciate that adding a rule and a field are relatively minor steps to setting up expiry on coupons. However, I find it hard to imagine a scenario where a coupon would *not* have an expiry date associated with it. Whilst this module could potentially bloat up if every conceivable scenario were incorporated into it, I think this feature is an exception.
Any accountant worth their salt will tell you that having coupons out in the wild that are valid forever is a nightmare from an accrual accounting point of view since they can theoretically be redeemed at any point in the future, which means the accountant needs to carry a liability on the books forever as well. That's messy.
Setting a limit on redemptions is a counter-argument to that, but if I create a voucher for 500 redemptions and only get 200 redemptions within my campaign period then I really want that coupon to die so I don't keep getting unexpected redemptions from now until whenever.
In an ideal world, I would expect the expiry date to be a mandatory field (with an optional valid-from field). I would argue that this feature should be a core feature of any coupon/discount module. I'd code a patch myself but my coding is as good as my singing.
To be clear - I'm not asking for this feature. I'll create fields and rules if I need to. But if there's a roadmap, this post is my +1 for including expiration dates in the module as a core feature.
David
Comment #16
jwjoshuawalker CreditAttribution: jwjoshuawalker commentedHaha, good points. Yeah like I said, I don't see this as an edge case at all. I hadn't thought of it being that critical, but you make a good point.
Comment #17
kovacsaba CreditAttribution: kovacsaba commentedI see there are too much passion on comment flow. So I picked up all you ideas and i created a sandbox project related to this issue.
Check out the project:
https://drupal.org/sandbox/minarikede/2120313
Any comments are welcomed!
Comment #18
glimberg CreditAttribution: glimberg commentedThanks for this technique. It works great!
Comment #19
darksnow CreditAttribution: darksnow commentedI realise this a couple of years old now but I've been looking into getting this to work and hit a major snag.
There is no commerce_coupon_validate rules trigger. I can't see anything like that in the rules UI and a grep through the code for commerce_coupon (and all controb modules) doesn't find any mention of that rule.
I have commerce_coupon 7.x-2.0-rc2 installed.
Comment #20
czigor CreditAttribution: czigor at Liip for FREITAG lab. AG commentedSince 2013 December we have commerce_coupon_date as a submodule of commerce_coupon. I think we can close this.