Syncing Stock Levels

Syncing Stock Levels

You』ve imported all of your products into WooCommerce. You have a separate XML or CSV file containing your stock levels, and you want to synchronize the stock levels on your site with the stock levels in your XML or CSV file.

You only need these instructions if you have a separate file with stock levels. If the same file you used to import your products also contains your stock levels, just use the Re-Run Import option. 

Each record in your stock level feed must contain the stock quantity or status, and an identifier that will allow WP All Import to assign the correct stock level to the correct product. Usually, this will be the product』s SKU.

Stock Record

Use the following settings in Step 1 of WP All Import.

Import Stock Levels

Note that we』ve specified the URL to our stock levels file. Later, this will allow us to set up a cron job to automatically download and import the stock levels from this URL, every day.

Continue to Step 3, and set your Stock Qty in the Inventory tab of the WooCommerce add-on. You can leave all other settings and sections of Step 3 blank, or at the default values. The Product Type, for example, can be left at Simple product, even if you are updating stock for other types like Variable products. The only settings that WP All Import will pay attention to are those related to product stock.

Step 3 Stock Settings

Now continue to Step 4. WP All Import may warn you that your post title and content are blank, but you can ignore this. We don』t need to import post titles and content, only stock levels.

In Step 4, it』s time to specify how WP All Import knows which product a stock level in a particular row or record in your XML or CSV file should be assigned to.

We do this using the SKU. Our file contains the SKU that each stock level is associated with. Using the following settings, we tell WP All Import that for each record or row in our file, it should search for a Product containing an _sku Custom Field with the value in our file』s SKU column, and then import data into that Product based on the options we specified in Step 3.

Record Matching

Now we need to tell WP All Import to only update our product stock levels. WooCommerce stores these stock levels in Custom Fields called _stock and _manage_stock.

When the import is run, WP All Import needs to leave everything else alone. To do that, we use the Choose which data to update option.

You』ll also notice I』ve unchecked the Create new and Delete options, since we only want to import into existing Products.

Only update stock

I』ve chosen to only update the _stock and _manage_stock Custom Fields.

Run the import, and your Products will now show the updated stock statuses and quantities.

You can easily configure WP All Import to automatically re-check the stock XML or CSV file at a specific interval to keep your product stock levels always up to date, using cron jobs.

Note: If you remember, in Step 3 in the WooCommerce add-on, we left 「Simple Product」 as the Product Type. Notice that the Product Type box is left unchecked. This allows WP All Import to import stock levels to both simple and variable products at the same time, or just variable products, without updating their Product Type based on our selection in Step 3.

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注