Is there a way to override the Cartthrob license key generation process? Currently Cartthrob just defaults to a UUID, but we have a more in-depth license generation process that is required for our project. I can probably hook into cartthrob_on_authorize, but am wondering if there is a better way.

2 Answers 2


There is no way to override the built-in key generation. I would recommend turning it off in the settings (by leaving the License Number field mapping empty in the Purchased Items channel). And then using the cartthrob_on_authorize hook.

foreach (ee()->cartthrob->cart->order('purchased_items') as $entry_id) {
    // generate your own license key
    //$key = ?

    // save the key to the DB, where XXX is your Purchased Items' license number field ID
    ee()->db->update('channel_data', array('field_id_XXX' => $key), array('entry_id' => $entry_id));
  • Thanks Rob, much appreciated. This is the route I ended up taking. May 5, 2015 at 14:54

No I think creating your extension and hooking that event is the right way forward. This sort of thing is why they put hooks in there after all, do you think that hook will be too late, i.e. after UUID generation?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.