How to add a file license to an existing product (downloadable file)


is there a way to manually issue a file license to an existing product? As far as I know, I can only issue a new license if I upload the respective file. (admin>shop>file licenses>add new license)

What I need is...
1. manually generate an order (that works fine and I can view the order in the user account)
2. issue a file license so that the user can download the file.

In theory this should work with updating the order status but it doesn't. I couldn't find a fix so it would be easier to do it manually.

Any ideas?


Posted: Apr 17, 2012


yanniboi on September 16, 2012

Hey Brian,

I had the same issue. I had a quick look in the Rules for Drupal Commerce and I think if I could replicate the 'create license for products in order' action i could write a rule for issuing licenses without have to upload a file (this could get messy quickly...).

At the moment however, you should be able to create a license for a product by purchasing it (using the example payment method for example) and once a licence for a specific file exists you can clone it (in the add license menu) and then assign the cloned license to a specific user.

Hope that helps (even if its just putting a band aid on it ;) )

julitroalves on November 30, 2012

I think that you can use this function commerce_file_license_issue_by_commerce_order($order, 'active', TRUE); in couple you can also use hook_commerce_order_update and verifies IF $order have status 'completed'.