• Resolved ermosa

    (@ermosa)


    Thank you for a really great plugin! Highly appreciated!

    I′m having an issue with stock updating (I use WC built-in .csv importer) – when I update the stock of each location, it all works fine, but the WooCommerce default stock does not update (remains the same) as shown here: LINK
    In the screenshot, you can see that the locations stock add up to 24 (9+2+3+6+4), but WC default stock remains at 22 where it was before.

    The default WC stock updates and comes to sync with locations stock only when I open each product edit page and update each product one by one. That is not sustainable as I have 470+ products and growing every day.

    So the issue is, that the default stock does not represent the sum of the locations stock.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor alexmigf

    (@alexmigf)

    Hi @ermosa

    You have to update the default WC stock also under the meta _stock.

    Let me know.

    Thread Starter ermosa

    (@ermosa)

    Okay, thanks! I′m doing that already, I just thought there′s a way that once I entered the locations stock, the default _stock will represent the sum of the locations stock automatically.

    Plugin Contributor alexmigf

    (@alexmigf)

    Hi @ermosa

    Probably you can use this hook (not tested) to update the stock meta, but would require a custom snippet to do that.

    Thread Starter ermosa

    (@ermosa)

    Hi @alexmigf

    Thank you! Will look into it.

    jurijuri

    (@jurijuri)

    Hello @alexmigf
    Thank you so much for plugin. I am not expert in coding, but I have same problem. Are you maybe able to give me more detailed information how to update default WC stock automatically, please? I have 2 locations which I’m updating through WP All Import Pro.

    Thanks so much in advance.

    Plugin Contributor alexmigf

    (@alexmigf)

    Hi @jurijuri

    You have to update the default stock on WP All Import run using this code snippet:

    add_action('pmxi_saved_post', 'wsl_pmxi_update_product_stock_status', 10, 1);
    function wsl_pmxi_update_product_stock_status( $id )
    {
    	$stock = get_post_meta($id, '_stock', true);
    	if ($stock > 0) {
    		update_post_meta($id, '_stock_status', 'instock');
    	} elseif ($stock == 0) {
    		update_post_meta($id, '_stock_status', 'outofstock');
    	}
    }
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘The default stock does not represent the sum of the locations stock’ is closed to new replies.