Commerce AutoSKU allows administrators to generate SKU's for Drupal Commerce products automatically. Using tokens, the SKU can be generated based on the value of arbitrary product fields such as title, author, or any custom fields you have added. Additional sitewide tokens are available when the Token module is enabled.

Use Cases:

  • You don't use the SKU field for anything important, and would prefer not to be required to fill it in each time you create a product.
  • You want the SKU field to follow a rigid predefined structure. An example would be SKUs like "LARGE-RED-TEE" which would be generated from a pattern such as
    [commerce-product:field_size]-[commerce-product:field_color]-[commerce-product:title]

Configuration/Setup

Once the module is enabled, you can configure the SKU pattern used for each of your product types on the main product type edit form (admin/commerce/products/types/product, for the basic "product" type). It is reccomended that you use the Token module to help with token entry, but it is not strictly required.

If you decide to use the [product:product-id] token, you should be aware that this will cause any new products to be saved twice. This shouldn't be an issue for most people, but if you have rules in place for when a product is saved, you may not want to use this token.

This module was featured on Commerce Module Tuesday. Check out this screencast to see a demonstration on how to set it up.

Supporting organizations: 
maintains this module.

Project Information

Downloads