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.
Hello,
It would be nice to be able to alter the coupon code in commerce_coupon_load_by_code. I have a case where the codes are hashed before stored, therefor before loading the coupon by code I have to hash the user input (code raw value).
Of course I can work with form alter and add an element validate on the coupon_code element. However it seems to me that the cleaner way to do it is to implement drupal_alter before EFQ in commerce_coupon_load_by_code($code).
Attached a patch.
Thanks,
Mihai
Comment | File | Size | Author |
---|---|---|---|
#1 | commerce_coupon-commerce_coupon_load_by_code_alter-2201995.patch | 855 bytes | mihai_brb |
Comments
Comment #1
mihai_brb CreditAttribution: mihai_brb commentedComment #2
mihai_brb CreditAttribution: mihai_brb commentedAfter further working with this, for my case there is another function that needs alter.
commerce_coupon_code_is_valid.
I was trying to find a central point that allows coupon code altering. Any insight?
Thanks,
Mihai