If you are running ATUM Product Levels or ATUM Multi-Inventory on a website with Astra theme activated you may have some products with the wrong Out of Stock status in the products grid. Follow the next instructions to fix it.
The problem is in the Astra theme, when woocommerce loads the list of products execute a 'hook' where it checks if the product is in stock by directly obtaining the stock of the main inventory. One solution would be to create an Astra child theme and add this code in functions:
add_action( 'wp', function(){
remove_action( 'woocommerce_shop_loop_item_title', 'astra_woo_shop_out_of_stock', 8 );
add_action( 'woocommerce_shop_loop_item_title', 'astra_child_check_stock_status', 8 );
}, 10 );
/**
* Add Out of Stock to the Shop page
*
* @hooked woocommerce_shop_loop_item_title - 8
*
* @since 1.1.0
*/
function astra_child_check_stock_status() {
$product = wc_get_product( get_the_ID() );
$out_of_stock = $product->get_stock_status();
$out_of_stock_string = apply_filters( 'astra_woo_shop_out_of_stock_string', __( 'Out of stock', 'astra' ) );
if ( 'outofstock' === $out_of_stock ) {
?>
<span class="ast-shop-product-out-of-stock"><?php echo esc_html( $out_of_stock_string ); ?></span>
<?php
}
}