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.
Should allow the admin user to select how many coupons that want to allow against one order.
Comment | File | Size | Author |
---|---|---|---|
#14 | limit_coupons_against_order-1538158-14.patch | 2.11 KB | idflood |
#11 | 1538158.11-limit-coupons-against-order.patch | 2.05 KB | lathan |
#4 | 1538158.4-limit-coupons-against-order.patch | 2.63 KB | lathan |
#2 | 1538158.3-limit-coupons-against-order.patch | 2.63 KB | lathan |
#1 | 1538158.1-limit-coupons-against-order.patch | 2.68 KB | lathan |
Comments
Comment #1
lathanHere is a patch
Comment #2
lathanRerolled with fix to white space issue and changed cart to order in some paces that made more sense with descriptions.
Comment #3
pcambraI like the idea, but can't you do the same thing comparing by rules?
Comment #4
lathanJust attaching fix of last patch.
Looked at doing it via rules but looked a little over kill... will rework this to use rules.
Comment #5
pcambraDon't think that we should add behaviors that are not configurable by rules, not a huge fan of random configuration settings, I'll review the patch and see if we can easily integrate it or if we can do it already with some rules config.
Thanks!
Comment #6
pcambraOk, came up with a rule to handle this. This won't get into commerce coupon itself, but we may want to have new action called "get number of coupons applied to an order"
Component
And main rule
Comment #7
pcambraMarking this #1341384: One Coupon per Order as duplicated of this one.
Comment #8
lobo235 CreditAttribution: lobo235 commentedRegarding the Rule in #6, I cannot get the rule to import because it gives the following error message:
Integrity check for the imported configuratoin failed. Error message: Unknown action commerce_coupon_action_get_coupons_for_order
The component imported without any issues but I can't get the rule to import. Can anyone provide any help on this? I really need to be able to limit the customer to one coupon per order.
Thanks!
Comment #9
valante CreditAttribution: valante commentedI also need this functionality urgently.
What I tried to do:
- Set up a rule on Coupon validation
- Loop over line items
-- If line item is a coupon, make coupon invalid
For some reason, none of the line items get recognized as type "Coupon"? Is this a bug, or am I missing something?
Comment #10
valante CreditAttribution: valante commentedSolved!
Only works with one coupon, though. :)
Comment #11
lathanThere was a bit of an over site in the recent refactor removing the action commerce_coupon_action_get_coupons_for_order this patch restores that and allows the rule out lined in #6 to function once again.
Comment #12
lathanupdate status.
Comment #13
pcambraI think we should filter out status = 0 coupons from here.
Maybe an Entity Field Query makes more sense here?
We should use order_id, order number might be equal or not to the id
Missing t()
Comment #14
idflood CreditAttribution: idflood commentedThanks for this rule. Here is the same patch as #11 with the corrections from #13.
Comment #15
brunorios1 CreditAttribution: brunorios1 commented#14 + #6 worked here.
Comment #16
pcambraAnd committed! thanks
Comment #18
bmx269 CreditAttribution: bmx269 commentedI can not find the rule if this was committed, has it been committed to dev?
Comment #19
pcambraThe action is just there.
http://drupalcode.org/project/commerce_coupon.git/blob/refs/heads/7.x-1....
As it is mentioned in #6 already, the complete rule does not belong to the module, but you can build it using this action quite straightforward
Comment #20
bmx269 CreditAttribution: bmx269 commentedOk, Gotcha. Thanks.
Comment #21
caschbre CreditAttribution: caschbre commentedI realize this is an older issue but before creating a new one I wanted to check and see if this applies to 2.x?