Back to blog
10 min read Automation

Sync WooCommerce Stock Between Two Stores That Sell the Same Products

The roastery sells its beans in two WooCommerce stores: the main shop, which ships from the roastery’s own warehouse, and a second store for the café next door. Both sell from the same shelves. When the café store sells three bags of Filter Roast, the main store has to know, and when the main store gets a delivery, the café store has to show it. Otherwise one of them sells coffee that is no longer there. We set this up with two files on an SFTP server and four hourly schedules, then checked the numbers on both stores after the runs.

PRO: exporting and importing WooCommerce products and orders is part of PRO. Saved FTP and SFTP servers and schedules work in the free plugin. Tested with Import Export by RockStarLab 2.2.46 and PRO 2.1.42, WooCommerce 11.2.1, WordPress 7.1.5.

Short Answer

Pick one store as the owner of the stock, here the main store. Every hour it exports SKU and stock quantity to a file on an FTP or SFTP server, and the second store imports that file, matching products by SKU and skipping SKUs it does not sell. In the other direction, the second store exports its orders to the server every hour, and the main store imports them with Reduce the stock of ordered products turned on. Each sale then lowers the stock in the main store once, a cancelled or refunded order puts it back, and the next stock file brings the new number back to the second store.

Why One Store Has to Own the Stock

Copying stock both ways does not work. If each store sends its quantity to the other, the last file wins and a sale in the other store is overwritten. WooCommerce stores a quantity, not a list of changes, so there is nothing to add up.

With one owner the arithmetic stays correct. Our test, step by step:

Event Main store: Filter Roast Café store: Filter Roast
Start (the café store’s count had drifted) 120 131
Stock file imported in the café store 120 120
Café store sells 3 bags 120 117
Café orders imported in the main store 117 117
Next stock file 117 117

The same works for Espresso Blend, which the café store sold two of in an earlier order: the main store went from 40 to 38.

Step 1: Save the Server on Both Stores

Both stores need the same FTP or SFTP server: the main store writes the stock file there and reads the order file, the café store does the opposite. Save it on each store under Import Export > Plugin Options > FTP / SFTP Servers. Import from and Export to FTP or SFTP Automatically shows that screen. We called the server “Stock exchange SFTP” and used two folders, /stock/ and /orders/.

Step 2: Export the Stock from the Main Store

Open Import Export > Export and choose WooCommerce Products. On the Filters step add Manage Stock equals yes. Products without stock tracking have an empty quantity, and an empty cell is not a number you want to send. Our store had 27 products with tracked stock.

Export Step 2: Filter Data with the filter Manage Stock equals yes and 27 items available
Only products with tracked stock.

On the Fields step drag in only SKU and Stock Quantity. A file with prices or names would overwrite those too.

Export file structure with two columns: SKU (sku) and Stock Quantity (stock_quantity)
Two columns: SKU and stock.

On the Format step choose CSV, enter a fixed file name such as roastery-stock and pick the server and the folder /stock/ under Upload to a server. A file with the same name is replaced on every run, so the café store always finds the current one.

Processing Options: custom export file name roastery-stock, One row per variation unticked, Upload to a server Stock exchange SFTP with folder /stock/
A fixed file name, uploaded to /stock/.

For variable products tick One row per variation: stock usually belongs to the variations, and each one has its own SKU.

Step 3: Import the Stock in the Second Store

In the café store open Import Export > Import, choose WooCommerce Products, pick the server, open /stock/ and click roastery-stock.csv. Auto Map links sku and stock_quantity to the fields of the same name. On the options step:

Import options: Check for Existing Items by Field SKU, If Match Found Update, If No Match Found Skip
Match by SKU, update, never create.
  • Check for Existing Items by Field: SKU.
  • If Match Found: Update.
  • If No Match Found: Skip. The café store does not sell everything the main store has, and the file must never create products.

Our first import updated 19 products and skipped 8 SKUs that the café store does not carry. The café’s own mug, which is not in the main store, kept its stock of 9.

Import Completed Successfully: Successful 19, Updated 19, Created 0, Skipped 8, Failed 0
19 products updated, 8 SKUs skipped.

Step 4: Send the Second Store’s Orders to the Main Store

In the café store export WooCommerce Orders with all columns, file name cafe-orders, uploaded to /orders/. Do not filter by status: a cancelled or refunded order has to reach the main store too. The schedule in Step 5 keeps the file small by exporting only orders changed since its previous run.

In the main store import /orders/cafe-orders.csv as WooCommerce Orders:

Order import options: Check for Existing Items by Field Order Key, If Match Found Update, If No Match Found Create, Product Stock: Reduce the stock of ordered products ticked
Order import options with Product Stock.
  • Check for Existing Items by Field: Order Key, which stays the same when an order moves between stores.
  • If Match Found: Update.
  • If No Match Found: Create.
  • Product Stock: tick Reduce the stock of ordered products.

Without that box an imported order is treated as history and leaves stock alone, which is right for a migration and wrong here. With it, the import keeps the main store’s stock in line with each café order. The order remembers how much stock it took, so importing it again only applies the difference:

The same café order arrives Stock in the main store
new, processing, 3 bags 3 taken off
again, unchanged no change
quantity changed to 5 2 more taken off
cancelled or refunded all 5 put back
reopened as completed 5 taken off again

We checked each row with a real import. In our first run the file created the order and took 2 Espresso Blend and 1 Decaf off the shelf, and the second run of the same file left the stock where it was. Orders that were in the main store before you turned the box on are left alone. Products are found by SKU, so the product IDs can differ between the stores.

Step 5: Schedule All Four Jobs

Open Import Export > Jobs Log > Schedules on each store and create an hourly schedule for each of the four jobs you just ran, with the start times a few minutes apart in this order:

  1. Café store: order export (:46 in our test).
  2. Main store: order import (:50).
  3. Main store: stock export (:55).
  4. Café store: stock import (:00).
Add schedule form: name Stock to SFTP, source job #250 Export WooCommerce Products, run type Recurring, repeat Hourly, first execution 23/11/2026 08:55
The stock export runs every hour.

For the order export tick Changes only (Export only items changed since the previous run) in its schedule. The first run exports all orders, each later run only the orders created or changed since the previous run, so an order cancelled at :30 is in the :46 file.

A schedule keeps the server address of the file, not a copy, so every run reads the current file. Schedules run with WordPress cron, which needs visits to the site or a real cron job on the server; a store with few visitors at night should use a server cron job.

In our run the café store sold 3 bags of Filter Roast at :44. The order export at :46 put the order on the server, the main store imported it at :50 and went from 120 to 117, and the stock file brought 117 back to the café store.

With WP-CLI or an AI Agent

The stock half of the setup runs without the admin screens. SERVER_ID is the id of the saved server from rsl-ie/remote-servers, so no password ever goes into a command:

# main store: SKU and stock to the SFTP folder /stock/
wp rsl-ie export --type=product --fields=_sku,_stock --options='{"variation_rows":true,"filters":[{"field":"_manage_stock","condition":"equals","value":"yes"}],"column_headers":{"_sku":"sku","_stock":"stock_quantity"},"remote_destination":"rsl-remote://SERVER_ID/stock/"}' --name=roastery-stock --user=admin

# second store: run the same file through the abilities, match by SKU, never create products
wp rsl-ie ability rsl-ie/upload-from-url '{"url":"rsl-remote://SERVER_ID/stock/roastery-stock.csv"}' --user=admin
wp rsl-ie ability rsl-ie-pro/import-start '{"request_id":"stock-1","file_id":"FILE_ID","import_type":"woo_product","mapping":[{"source_index":0,"target_field":"sku"},{"source_index":1,"target_field":"stock_quantity"}],"options":{"unique_field":"sku","if_exists":"update","if_not_exists":"skip"}}' --user=admin

# both stores: repeat the finished job every hour
wp rsl-ie ability rsl-ie/schedule-create '{"source_job_id":451,"name":"Stock to SFTP hourly","schedule_type":"recurring","recurrence":"hourly","start_at":"2026-11-26T11:55","status":"active"}' --user=admin

We ran these commands with Import Export by RockStarLab 2.2.64 and PRO 2.1.57 on our test store. Export job 451 uploaded roastery-stock.csv with 13 rows to the SFTP folder, one per tracked product and per variation. Import job 452 read the file straight from the server and updated all 13 products by SKU. The two schedules created from these jobs then repeat them every hour, and each run reads the current file on the server.

An AI agent connected through the WordPress MCP Adapter sets up the same chain from a request. Without the plugin, WordPress 7.1.5 gives the agent only three read-only abilities for site, user and environment information. The export to the server, the SKU match and the schedules are abilities of the plugin:

With Import Export by RockStarLab, export SKU and stock quantity of the products with stock tracking to the folder /stock/ on the server "Stock exchange SFTP" as roastery-stock.csv, then create an hourly schedule for that export starting at :55.
With Import Export by RockStarLab, import /stock/roastery-stock.csv from the server "Stock exchange SFTP" as WooCommerce products: match by SKU, update the stock quantity, skip SKUs this store does not sell, and repeat the import every hour at :00.

Only the two columns in the file reach the second store. Prices, names and descriptions are not in the export, so neither the agent nor the schedule can change them.

Schedule Order and Content Sync

  • Keep the four start times a few minutes apart in the order from Step 5. Each job then reads a file the previous job has just written, and a sale reaches the other store within the hour.
  • Content Sync and this setup work side by side: a Content Sync push keeps the stock of the receiving store on purpose, so pushing new descriptions or images never overwrites the numbers the schedules maintain. Content Sync Keeps Your Store’s Stock explains it.

FAQ

Can two WooCommerce stores share one stock?

Yes, if one store owns the stock. It sends SKU and stock quantity to the other store every hour, and the other store sends its orders back, imported with Reduce the stock of ordered products.

Why not sync stock in both directions?

WooCommerce stores a quantity, not changes. When both stores send their quantity, the last file wins and a sale in the other store is lost.

Does importing orders reduce stock twice?

No. Each imported order remembers how much stock it took, so importing the same order again changes nothing. A cancelled or refunded order puts its stock back, and a changed quantity is corrected.

How often does the stock update?

As often as the schedules run, hourly in our test. Schedules use WordPress cron, so a site with few visits needs a server cron job.

Can an AI agent set up the stock sync?

Yes. With Import Export by RockStarLab connected through the WordPress MCP Adapter, an agent can export SKU and stock to the saved server, import that file by SKU in the second store and create the hourly schedules.

Get the free plugin on WordPress.org. Product and order imports are part of PRO.

Dmitriy
About author

Dmitriy

WordPress Developer with 15+ years of commercial experience. Elite Author on ThemeForest and creator of custom WordPress plugins. Passionate about clean code, performance optimization, and building useful tools for the WordPress community.

JOIN THE CONVERSATION

Comments 0

Have a question or a tip to share? Leave it below.

Leave a comment

Your email address will not be published. Required fields are marked *

We store your name, email and comment to show and moderate it; your email is never published. Spam protection is provided by Cloudflare Turnstile and profile pictures by Gravatar. See our Privacy Policy.


Try the plugin with no risks!

New users get 1 month with access to all premium features. Experience the most powerful WordPress data engine today.

Download Now
Get PRO for FREE