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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mihai_brb’s picture

mihai_brb’s picture

After 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