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.
This feature is similar to http://drupal.org/node/1407498.
My use case was a monthly sale set with pricing calculation rules, that should not be applied when certain coupons had been applied to the order.
The condition is configured on the price calculation rule after a call to entity has field 'commerce_coupon_order_reference' using the order from the line item and a directly specified coupon.
Comment | File | Size | Author |
---|---|---|---|
commerce_coupon_rules_order_has_specific_coupon.patch | 1.62 KB | dopry | |
Comments
Comment #1
dopry CreditAttribution: dopry commentedComment #2
pcambraPlease fix the extra spaces
Wording improvement suggestion: "Coupon has been applied to an order"
Missing t()
Not following drupal standards for ifs
Same here
Coupons may be disabled, status = 0, so we may want to create an api function with uses entity field query for this
Comment #3
Horroshow CreditAttribution: Horroshow commentedThanks for the patch
Comment #4
aidanlis CreditAttribution: aidanlis commentedif (empty($order)) return true;
What's the logic behind that? Shouldn't we return FALSE if either of the parameters is invalid?Also be good to specify whether the coupon identifier is the coupon string or the raw ID.
Comment #5
ssoulless CreditAttribution: ssoulless commentedI think this patch should be recreated for use wtin 2.x branch, also fixing the problems that @pcambra already said.
Comment #6
ssoulless CreditAttribution: ssoulless commentedok I do not understand why is necesarry this part in the patch
Should be removed
Comment #7
ssoulless CreditAttribution: ssoulless commentedand regarding the comment of @aindalis, yes it would be better idea to specify that the condition checks for the coupon raw id and not the coupon code itself, but would be better idea to change to be the "coupon code" because is more friendly for the users...