What options are they to achieve a unique identification number for each item sold in a commerce store.

I want to have a unique number for each item on each transaction, the number needs to be unique across all transactions.

even if I have 5 of the same line item in an order I should still get 5 unique numbers.

I have a unique id number per item per order but i don't know how to achieve a truly unique id. Would appreciate any guidance.


There a two main options there:

  1. Order ID
  2. Line Item ID

The Order ID is unique across all orders.

The Line Item ID is per-line item on the order and is also unique across all orders. Each line item on an order has a unique Line Item ID.


prepend your unique id with the order number. Since it's already unique within the order, and presuming an order number is unique, [order-number]-[unique-id] should return a truly unique value with the added benefit of being traceable since the order number would have a searchable or reference-able value.


Further research yielded the module Field default token

This module enables to use tokens as field default values.

Using this you should be able to create the order-ID combination (or any other combination). To prevent user tinkering, I would also suggest Field Permissions:

The Field Permissions module allows site administrators to set field-level permissions 
to edit, view and create fields on any entity.
  • Their is an option in store=>products sku that will provide you to add unique id for each product sold or listed – harsh_behl_0007 Aug 23 '14 at 6:15
  • I believe op wants a unique number for each item on each transaction, not a unique item number as they indicate they already produce a unique id per transaction, but that number isn't necessarily unique across multiple transactions – Geoff Aug 23 '14 at 14:22
  • @Geoff Yes thats exactly it. I would like to have a unique number for each item on each transaction that's unique across all orders – Samp Aug 23 '14 at 15:14
  • see my edit.... – Geoff Aug 23 '14 at 15:45
  • @Geoff ok so if i understand that correctly after adding a field to the line item and specify the correct token, each time an item is added to an order it should have a unique id. – Samp Aug 23 '14 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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