Support » Plugin: Stock Locations for WooCommerce » Total Stock not updating without manual save post after WP All Import

  • Hi there Alexandre and everybody !

    Youve made a great plugin and importing with WP All Import works to locations, but the total stock isnt updating after import without manualy updating the product / variation.

    Were using it on but as you can see on product you cant add it to cart even when the variation is in stock.

    The problem is with Total Stock.
    I get errors like:

    — The total stock doesn’t match the sum of the locations stock. Please update this product to fix it.
    — To be able to manage stock locations in M, please add a price and activate the Stock Management under the variation settings.

    (all variation prices are set)

    But after manually saving the product / variation its working like a charm. (But we have thousands of products)

    I thought that its problem with WP All Import not saving the products after import, but Ive tried to import with:
    OFF – Increase speed by disabling do_action calls in wp_insert_post during import.
    But the result is the same.

    Could you please help me fix this problem , or atleast give me some tip how to proceed?

    Thank you very much for your answer in forward!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter LEAX.SK


    Ive added this code to product template (oxygen builder) and atleast the right stock numbers are showing in variations + you can add to cart .

    BUT after adding to cart the woocommerce shows a notification that theres no stock amount. –> after visiting the product in administration the total stock are still wrong.

    global $product;

    $product_id = $product->get_id();

    $update_locations_stock = \SLW\SRC\Helpers\SlwProductHelper::update_wc_stock_status( $product_id, $stock_qty = null );


    There needs to be a way to fix it ://

    Thread Starter LEAX.SK


    This is the Total stock that Im fighting with after importing:

    #65113 (M)
    Ihneď k odberu (Košice): 1
    Externý sklad (dodanie 2-4 dni): 0
    Total Stock: 0` — should be 1

    Is there something that should be added to WP All Import add_action(‘pmxi_saved_post’ ?




    I have the exact same problem! Shows in stock in the locations I have selected and I use WP All Import to update custom fields

    But as you said, I need to go into every singel product and just update it to get it to update the total stock, this is quite annoying. I think there is a way to update the stock with “_stock_at_1011 + _stock_at_1010” in WP All Import but I haven’t done it successfully yet.

    Please fix this problem or tell us how Alex!

    Hello again!

    Found a solution, add this code and run the import again! 🙂

    Hi guys, did you change something in that code?
    It didn’t work for me, the stock total isn’t updated.
    I have the same issue and it’s a real problem.

    Thread Starter LEAX.SK


    @andreasene thank you bery much for the link
    looks like that code works for me as of now

    1. Isnt your import skipping unchanged products ?
    2. Maybe you will need to UNcheck to skip do_action calls in your import settings (slower import)
    Did it help?

    Problem fixed, I added the code directly in the “function” of the concerned imports.
    Thanks 👌

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.