I've setup a Drupal Commerce site selling licensed roles per instructions on https://www.drupal.org/node/2039687 The same pages says:

The customer receives the role referenced by the purchased license product. Changing $license->product_id (from "Basic Membership" to "Premium Membership", for instance) changes the owner's role.

However, it is unclear how to change the $license->product_id. Can anyone clarify can this be done in some kind of UI or rule, or if it should be done in custom module then which hook to use?

1 Answer 1


I'm not sure there is an easy answer to this right now. Product IDs are updated on licenses when a line item is created or updated. This happens in commerce_license_commerce_line_item_presave().

This gets complicated if you're using Commerce License Billing because your order renews according to your billing arrangement. If you are using that, then you'll need to review the code in there and figure out a way to save a new order that will be the one that gets renewed.

Otherwise, you could just create a new order, set the correct product, revoke the old license, and then complete the new order and then a user will have a new license and the old one will be gone.

If you have more questions, the issue queue is probably the best place to get help and provide feedback.

  • Sounds like creating new order is easier way to go, however it's still not clear to DC newbie like myself can that kind of change of licenses be done through UI purely based on rules or a custom module needs to be developed. Manually creating and completing a new order by DC admin doesn't trigger a customer's credit card on file for some reason, but it works fine if a customer places and completes his order. I am just trying to figure out how to upgrade or downgrade subscribed licenses from admin's perspective.
    – Nick
    Dec 26, 2015 at 16:49
  • And I feel more comfortable to post questions here on DSC than on the issue queue. One of the reasons is that you have more chances to get a response here than on DO.
    – Nick
    Dec 26, 2015 at 16:52
  • 1
    That's true. However the folks who have the most experience with it usually don't pay attention to SE and are on IRC all the time. You are correct that there isn't an easy way to do it in the UI.
    – nvahalik
    Dec 26, 2015 at 18:29

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.