Workflow templatesSave the previous SKU when a variant SKU changes

Save the previous SKU when a variant SKU changes

Copy page

When a variant's SKU changes, store the old SKU in the variant metafield custom.previous_sku. Warehouses, marketplaces and ERPs that still know the old SKU can be mapped to the new one. Shopify keeps no SKU history and its own Product updated trigger cannot watch the SKU at all.

When a variant's SKU changes, store the old SKU in the variant metafield custom.previous_sku. Warehouses, marketplaces and ERPs that still know the old SKU can be mapped to the new one. Shopify keeps no SKU history and its own Product updated trigger cannot watch the SKU at all.

One trigger, built-in Shopify actions only, no other app needed. Nothing in it is specific to a store, so it works as soon as it is imported.

The workflow in Shopify Flow: Save the previous SKU when a variant SKU changes
The complete workflow as it looks in Shopify Flow.

What it needs

  • The app's permission Product, Variant & Collection Data Access. See Permissions and data access.
  • Nothing else: turning the workflow on switches the trigger Product Variant SKU Changed on in the app.

Install the Workflow Trigger Extensions app and grant Product, Variant & Collection Data Access on its Permissions page. Turning this workflow on switches the trigger on in the app.

Get the workflow

  1. Download the .flow file attached at the bottom of this page.
  2. In your Shopify admin open Flow, click Import and choose the file.
  3. Check the steps, then click Turn on workflow.

The file is an export from Shopify Flow itself. Do not edit it by hand; change the workflow in Flow after importing it.

How it works

  1. Product Variant SKU Changed carries skuChange with oldSku and newSku.
  2. The Condition continues when skuChange.oldSku is not empty, so a variant that gets its first SKU is skipped.
  3. Update product variant metafield writes {{ skuChange.oldSku }} to custom.previous_sku (single line text).

Make it yours

  • Create a metafield definition for custom.previous_sku under Settings > Custom data > Variants to see it in the variant editor.
  • Add Send internal email with the old and the new SKU for your warehouse team.

Next steps