Replace a SKU in New Shopify Orders Automatically

7 min setup
No coding required
Runs automatically

When a product is discontinued, renamed or replaced by a new version, orders can keep coming in for the old SKU and someone has to edit each one by hand. This workflow watches new Shopify orders, and when a line item has the old SKU, it edits the order to swap in the replacement variant at the same quantity and tags the order so your team knows it changed.

Shopify logo icon
Shopify Order Created (Trigger)
Shopify Retrieve Product Variant Details from SKU
Shopify GraphQL Query
Shopify GraphQL Query
Shopify logo icon
Shopify Order Add Tag

How it works

7 steps to swap an old SKU for its replacement on every new order

Shopify logo icon

Shopify Order Created (Trigger)

App connector: Shopify • Time to complete: 1 minute

Runs for every new order.

Loop

App connector: Loop • Time to complete: 1 minute

Go through the order's line items one at a time.

Filter

App connector: Filter • Time to complete: 1 minute

Continue only for a line item whose SKU matches the old SKU you want to replace, and that is not yet fulfilled.

Shopify Retrieve Product Variant Details from SKU

App connector: Shopify • Time to complete: 1 minute

Look up the replacement variant by its SKU to get its variant ID.

Shopify GraphQL Query

App connector: Shopify • Time to complete: 1 minute

Run an order edit: begin the edit, set the old line item's quantity to 0, and add the replacement variant at the same quantity. Return the calculated order ID.

Shopify GraphQL Query

App connector: Shopify • Time to complete: 1 minute

Commit the order edit with the calculated order ID, without notifying the customer.

Shopify logo icon

Shopify Order Add Tag

App connector: Shopify • Time to complete: 1 minute

Tag the order sku-swapped so your team can see which orders were changed.

Trusted by 1,000+ merchants
Logo: Rothy's Logo: Adidas Logo: Allure Logo: GQ Logo: DraftKings Logo: Chubbies Logo: Made In Cookware Logo: MUD/WTR

Ready to swap an old SKU for its replacement on every new order

Get setup in 7 minutes.

Use this template →

FAQs

Does the customer pay a different price?

Shopify recalculates the order with the replacement's price. If the prices differ, you can add a discount to the new line item in the order edit, or keep the two variants at the same price.

Can I replace more than one SKU?

Yes. Use a logic step in place of the filter to map each old SKU to its replacement, or keep a list of old and new SKUs in a sheet and look up each line item.

Will this change orders already fulfilled?

No. The filter skips fulfilled line items, and the workflow only runs on new orders.

Personalize this template

Customize this workflow even further:

Email the customer about the change
Set the order edit to notify the customer, or add a Send Email step that explains the replacement.
Only swap when the old SKU is out of stock
Check the old variant's inventory first and swap only when it can't ship, so remaining stock still sells.

You're in good company

"MESA has been a game changer for us. And, if you ever get stuck, their support team is always super helpful."

  • Ico star
  • Ico star
  • Ico star
  • Ico star
  • Ico star
PetFriendly

"It's like Zapier but exactly designed for Shopify. I have been able to complete all the workflows that I've needed."

  • Ico star
  • Ico star
  • Ico star
  • Ico star
  • Ico star
Zailys

"The MESA team has been amazing at helping us set up our automations. We would highly recommend this app!"

  • Ico star
  • Ico star
  • Ico star
  • Ico star
  • Ico star
Rothy's

swap an old SKU for its replacement on every new order

7 min setup • Fully supported if you need help