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 https://bicyclegarage.sk but as you can see on product https://bicyclegarage.sk/21-c-dale-trail-27-29-5-womens-c26351f10-lav/ 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

    (@leax)

    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.

    <?php
    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

    (@leax)

    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

    https://www.dropbox.com/s/ldqtj5ksxuzrfpd/Screenshot%202021-08-19%2022.26.44.png?dl=0

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

    andreasene

    (@andreasene)

    Hello!

    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
    _stock_at_1011
    _stock_at_1010

    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! 🙂
    https://gist.github.com/alexmigf/384633c5cdb12c6444fce69b29a15e97

    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

    (@leax)

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

    @kenteush29
    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.