Product stock notification not working on single product

This topic has 2 replies, 1 voice, and was last updated 6 hours, 58 minutes ago ago by TheOne

  • Avatar: TheOne
    TheOne
    Participant
    February 26, 2025 at 09:06

    Hello,

    The customer just notify me that product stock notifier is not working (module: product stock).

    1. If you visit product in private (under 1.). You will notice it’s a variable product. 1000 pcs are set to “out of stock” and 300 pcs are on stock. The problem is that it’s not showing the “out of stock” notification instead it shows “in stock” but it’s not.

    2. I have a code in functions.php that always chooses the first variation so that the add to cart button stays active.

    3. If you check in private under 3. you will see a product that is also not in stock but the notification shows just fine.

    Content is visible for topic creator and
    support staff only.
    1 Answer
    Avatar: TheOne
    TheOne
    Participant
    February 26, 2025 at 09:11

    Let me add a thing. i have a code that displays in stock status:

    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’] = __(‘Na voljo takoj’, ‘woocommerce’);
    return $availability;
    }

    Is this the problem? The theme itself doesnt display stock status?
    I see it works for simple but not variable products.

  • Viewing 2 results - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.