• Resolved gevcen

    (@gevcen)


    Dear,

    If we define the product with “Manage Stock = Yes”, then the product page shows the label “In Stock” once we select all the attributes.

    If we define the product with “Manage Stock = No” but we still set “Stock Status = In stock”, then the label “In Stock” doesn’t appear in the product page.

    1) Is the second scenario the expected behavior?
    2) If yes, iIs there any way to force displaying the label “In Stock” ?

    Thanks

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @gevcen,

    This isn’t available by default, but you can add it using the following snippet:

    add_filter( 'woocommerce_get_availability', 'wc_always_display_stock_status', 10, 2 );
    function wc_always_display_stock_status ( $availability, $_product ) {
        if ( $_product->is_in_stock() ) $availability['availability'] = __('In Stock', 'woocommerce');
        return $availability;
    }

    Place that in your functions.php file. You’ll then see the stock status on your product page.

    Let me know if you have any further questions! ??

    Thank you,
    Joey

    Thread Starter gevcen

    (@gevcen)

    Hi Joey,

    Thanks for the code. I tried your code but it says “syntax error, unexpected ‘&'”
    Can you help please?

    Thanks

    @gevcen,

    I’ve tested this locally and had no issues.
    I would just suggest you look over what you pasted to be sure it matches what I pasted above perfectly.

    This is still custom code, so if you have continued issues, you may consider reaching out to a developer.

    Thank you,
    Joey

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Manage Stock (Yes-No) shows or not label “In stock” in product page’ is closed to new replies.