I deal with a few clients that want discounts added automatically based on a referral source to the website. If someone comes from an affiliate partners website, a token is placed in the URL and I check for this in another module that will set a cookie indicating they should get the discount. At the end of get_discounts_for_order() function, I only allow the discount to 'pass' and be applied if that token is present.

I suggest adding in a custom PHP discount validator for each discount. This opens up other developers to use that area of the GUI to put in their PHP without hacking the module.

I'll see if I can roll a patch for this soon.

Comments

jrust’s picture

Couldn't you do this using the uc_discount_alter() hook that's mentioned in the README?

bkosborne’s picture

huh? There's nothing in the README about that... and I can't find any refs to it in the code....?

jrust’s picture

hmm, maybe I haven't released :/ #1155784: Implement hooks for discounts

bkosborne’s picture

Could you roll a dev release for that if you can? I need that functionality for a project. Thanks

jrust’s picture

Status: Active » Fixed

Dev release is rolled nightly, so it should have what you need.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.