When a new order is created in WooCommerce, loop through the line items using Iterator, call WooCommerce PHP function wc_get_product to get the product data for the product ID, and add details to Google Spreadsheet
Each new WooCommerce order is split into its line items with an Iterator. For every item, a PHP Functions step calls wc_get_product on the product ID, and the result goes into a new Google Sheets row.
WooCommerce
Google Sheets4 steps Setup ~8 min Used on 3.1k sites Free to import

What this workflow does
An order record tells you what was bought, but a line item on its own carries little about the product behind it. If you want a sheet where every sold item sits on its own row next to product details from your catalog, you need to look each product up. This template does that lookup inside WordPress, item by item.
The WooCommerce trigger fires as soon as an order is placed in your shop, and its data starts the run. An Iterator then loops through the order's line items, so the next two steps repeat once per item. In each pass, the PHP Functions step calls WooCommerce's wc_get_product function with that item's product ID, which reads the product from your own store database.
The last step writes a row to Google Sheets for the current item. You decide which columns hold order data, line item data and the product data the function returned. An order with three products gives you three rows. The Iterator and the PHP step ship without settings, so you point the Iterator at the line items array and set the function and its parameter after import. A test order shows exactly what each step returns.
Item-level sales sheet with SKUs
A store owner wants one row per product sold, with the SKU and current price read from the catalog, to sort and total in Google Sheets without exporting orders.
Supplier reorder log
A shop that buys stock from several suppliers logs each sold item with product data from wc_get_product, then filters the sheet by product to see what to reorder.
Commission tracking per product
A marketplace-style store pays makers per item. Each line item becomes a row the bookkeeper can match to the maker who supplied that product.
How this workflow runs
What happens at each step once the workflow is on, and what you need before you import it.
WooCommerce New Order CreatedStarts the workflow whenever WooCommerce creates an order. The order data, including its list of line items, is passed on for the Iterator and the later steps to use.
Iterator Loop Through ArrayLoops through the array you map here, which should be the order's line items. The steps after it run once for each item, using that item's data such as its product ID.
PHP Functions by FlowMattic Call PHP FunctionCalls a PHP function on your site for the current item. Set it to wc_get_product and pass the line item's product ID. Run a test order to see which product values come back for mapping.
Google Sheets Add New RowAdds a row to your chosen Google Sheets spreadsheet for the current line item. Map columns to order fields, item fields and the values the PHP step returned, and connect your Google account.
What you need
- FlowMatticCore
- WooCommerce PluginPlugin
- Google Sheets AccountAccount
After importing, map your own data. To keep the template universal, not every step is pre-filled. Open each step in the builder and connect your accounts and fields (channels, lists, sheets, recipients) before you switch the workflow on.
Make it yours
Changes worth making after you import it.
- Place a test order with two different products after import. You can then pick the line items array in the Iterator and see the PHP step's output for each item before you map the sheet columns.
- Add a Filter after the Iterator that continues only for items in one product category or with a set SKU prefix. Items that fail it are skipped, and the loop moves on to the next item.
- Put the order number in the first column of the sheet. Rows from the same order then group together when you sort, even if a large order spans many rows.
Questions about this workflow
Does every WooCommerce line item get its own Google Sheets row?
Yes. The Iterator runs the PHP step and the Google Sheets step once for each item in the array you map, so an order with four line items adds four rows.
Why call wc_get_product instead of using the order data?
The order lists what was bought, while wc_get_product reads the product itself from your store. That lets you log product details the line item may not include. Check a test run to see which values your setup returns.
Does the PHP Functions step send my product data anywhere?
No. The function runs on your WordPress site, where WooCommerce and FlowMattic are installed. Only the Google Sheets step sends data out, to the spreadsheet you choose.
Will orders placed before import be added to the sheet?
No. The trigger fires on orders created after you turn the workflow on. Past orders stay in WooCommerce and are not copied.
More E-Commerce workflows
Other ready-to-import templates from the same category.








Import this workflow into your WordPress site
Download the JSON, import it from the Workflows screen and connect your accounts. Every run stays on your server, with no per-task fees.
30-day money-back guarantee Unlimited workflows and runs Self-hosted