Tags: SKU
Save time by letting this task keep your SKUs up to date, generating them based on your product handle, and the initials of each variant option. Optionally, choose to have the task skip updating variants that already have SKUs. Useful for large catalogs, or for anyone who has a consistent SKU format.
- View in the task library: tasks.mechanic.dev/auto-generate-skus
- Task JSON, for direct import: task.json
- Preview task code: script.liquid
{
"skip_variants_that_already_have_skus__boolean": true,
"product_options_to_keep_unabbreviated__array": null
}
Learn about task options in Mechanic
shopify/products/create
shopify/products/update
Learn about event subscriptions in Mechanic
Save time by letting this task keep your SKUs up to date, generating them based on your product handle, and the initials of each variant option. Optionally, choose to have the task skip updating variants that already have SKUs. Useful for large catalogs, or for anyone who has a consistent SKU format.
Please note: This task updates SKUs for all products, whether or not they're configured with options and variants.
This task automatically maintains SKUs by combining these elements and joining them with a dash:
- The last portion of the product handle (e.g.
503
, if your product is available atmyshop.com/products/stylish-shirt-503
) - The capital letters of the variant's first option, if there is one (e.g.
H
if the option isHeather gray
, orHG
if the option isHeather Gray
) - The capital letters of the variant's second option, if there is one
- The capital letters of the variant's third option, if there is one
(To use the product option's full value, instead of abbreviating it, add the option name to the "Product options to keep unabbreviated" list.)
To illustrate, a shirt available at myshop.com/products/stylish-shirt-503
, with options for size and color, might have these SKUs auto-generated:
- Medium, Black:
503-M-B
- XL, Heather gray:
503-XL-H
- Small, Red:
503-S-R
To update your product handle, so as to control the first portion of generated SKUs, open the product in the Shopify admin, scroll to the bottom of the page, click the edit icon next to "Search engine listing", and update the "URL handle" field to taste. :)
Find this task in the library at tasks.mechanic.dev, and use the "Try this task" button. Or, import this task's JSON export – see Importing and exporting tasks to learn how imports work.
Found a bug? Got an improvement to add? Start here: ../../CONTRIBUTING.md.
Submit your task requests for consideration by the Mechanic community, and they may be chosen for development and inclusion in the task library!