- 🇩🇪Germany Anybody Porta Westfalica
I agree it would make sense to store the SKU in order items for two reasons:
- The main reason given above: Keeping a reference for the books, even if the product has been deleted in the past
- Allow overriding the SKU for order items (=instances). We for example need this to store details of the configuration in the order item ID. In Drupal 7 that was possible, because the line item also stored the SKU. For example: The base SKU is: mywood123-100x200cm - which is later used by the client as unique identifier for the individual manufactured product. Drupal Commerce comes very handy for configurable products, so I don't think we'll be the only ones with a useful use-case.
So clear +1 on the idea of storing the SKU in line items at the moment they are added to cart!
Moving this to 3.0.x-dev!
- 🇫🇷France nicolasgraph Strasbourg
An approach to this issue could be to introduce an entity trait for order items to choose to store the SKU if needed + a dedicated order processor. It is what I use for now ; I can help with a patch or a light contrib module.
- 🇫🇷France nicolasgraph Strasbourg
I just created a light contrib module for this feature here → . I would just like to ensure that using "sku" as the trait field is ok ? I wouldn't like to conflict with a future implementation of this field.