How to get WooCommerce Product IDs from line items order?

  • 12 January 2023
  • 4 replies

Userlevel 4
Badge +4

I do have WooCommerce orders with line items (i.e. an order with multiple products). And I want to migrate the orders from an old WooCommerce site to a new one.

The problem is that the product IDs aren’t the same on both sites. My idea now was to search for the existing products in the new woocommerce site using their SKUs (as unique identifier) and get their responding product IDs to link it with the correct product on the new site. 

But the SKUs are available as line items (sku1, sku2, sku3 etc.). So how can I from each SKU the corresponding product ID? Do I have to use “Looping by Zapier”

Thanks for help.

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

4 replies

Userlevel 7
Badge +12

Hi @michael291!

Looping is a pretty advanced function and it can be tricky to catch everything when you’re using it for the first time, but it It looks like you have things set up the way that you need, nice work 🎉

Are you able to test the Zap with a new WooCommerce order? That’s the best way to make sure that it’s working as intended. 

Let us know how you get on!

Userlevel 7
Badge +14


Did you review the available help article that covers Looping?


Userlevel 4
Badge +4

Hi Troy, wow that was quick. But I do not understand how Looping is working. Because I need to search for the product IDs of all line items on the new site using the unique SKU. 

My plan was to: 

  • Get Product ID for first product (using the first line item/SKU)
  • Get Product ID for second product (using the second line item/SKU)
  • Get Product ID for third product (using the third line item/SKU)

And later to create a new order on the new site using the newly retrieved Product IDs from the new site and add it again as line items (10001, 10002, 10003). 


So I tried to do this:



Then I added a new step “Find Product in WooCommerce” and searched for the products using the SKU. But I only got the first product/line item. 

I think I am something completely wrong. 


Userlevel 7
Badge +14

Hi @michael291 

Good question.

Looping can be used to handle 1+ line items: