NO BUG: Woocommerce: in stock status is not displayed

Browser: Firefox
OS: Windows

{woo_product_stock} or in-build widget is not showing the ‘in stock’ status. ‘Out of stock’, ‘pre order’ and my custom status is showing as expected.

Hi Illarion,
Thanks for your report!

I need more details on this.

  1. What type of product is it?
  2. How do you manage the stock?

Best regards,
timmse

Hi timmse,

  1. Simple product
  2. Via native woocommerce product data

Ok. Normally, there is “confusion” (not a bug) with the product stock for variable products, but not for simple products. I can’t see any problem with that either.

Please send temporary login credentials, information on which product we have to look at, and a link to this thread to help@bricksbuilder.io using the email address you used during the purchase.

I found a solution on a stackoverflow, that override this ‘bug’

Here is the code, in case someone encounters the same problem

add_filter( 'woocommerce_get_availability', 'custom_override_get_availability', 10, 2);

// The hook in function $availability is passed via the filter!
    function custom_override_get_availability( $availability, $_product ) {
    if ( $_product->is_in_stock() ) $availability['availability'] = __('In stock', 'woocommerce');
    return $availability;
    }

I still don’t know exactly what the problem is, or how I can reproduce it, but if the code snippet works for you: ok :slight_smile: However, if it is a fundamental problem, it would be cool if we could solve it for all users - without custom code.