• Resolved kotisivutohtori

    (@kotisivutohtori)


    Hi,

    I noticed in product variations, if we have chosen ONLY “In stock” status, but not giving the quantity to some variations that are in stock. There is no info of “In Stock” visible on the frontend for those variation. Only if manage stock + quantity is added do we see the “In stock” detail. Some products we have plenty in the stock and can also produce then quicky, so we only want to show “in Stock” info in frontend. Why is “In stock” text not showing if Manage stock is not chosen? Some customers think the color is not in stock since there is not text (as the other variations have due to Manage stock chosen).


    I tested that the theme is not the issue, the same thing happens Twenty Twenty-Five theme.

    (Choose “Natural” variation for the product and you see that “in stock” variation has no info of stock at all).

    How can we get the “in stock” visible always even when Manage Stock is not chosen?

    Anne

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi @kotisivutohtori ,

    Great question—you’re absolutely correct in observing this behavior.

    By default, WooCommerce only displays the “In stock” message for variations when stock management is enabled and a quantity is set. If you leave stock management off, WooCommerce assumes you’re not tracking stock levels, so it doesn’t show any availability notice.

    There’s no built-in setting to display “In stock” for variations unless “Manage stock” is enabled.

    However, this can be changed with a custom code snippet or using a plugin that modifies variation messages. If you are not comfortable with custom coding, then I would suggest consulting a developer!

    Thank you.

    Thread Starter kotisivutohtori

    (@kotisivutohtori)

    Hi, thank you for this info. I tried finding custom code for this matter, but could not find anything. Would you be able to direct me to such code?

    Is it possible to add this matter to the development of WC? I think if the info “In stock” is chosen, that data needs to show up in frontend also. Makes no sence that is it not visible, but all other things are visible (out of stock, backorder etc).

    • Anne
    Stef

    (@serafinnyc)

    Thanks for additional info @kotisivutohtori can you please submit a SSR report for us so we can review? Please go to WooCommerce > Status > Get Systems Report, Copy that and use something like Pastebin or a code block here. Once we have that we can better assess any issues or possible custom code.

    If you could also take a screenshot of a product where you have the variant manage stock checked. Both on the parent end and on the variant side.

    Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi there!

    I understand your concern. Generally, we do not provide support for customizations. However, making an exception in this case — here is the code you can use to show the “In stock” message for variable products only.

    add_filter( 'woocommerce_get_stock_html', 'show_in_stock_for_variable_products', 10, 2 );

    function show_in_stock_for_variable_products( $html, $product ) {
    if ( ! $product->is_type( 'variable' ) && ! $product->get_manage_stock() && $product->is_in_stock() ) {
    $html = '<p class="stock in-stock">' . __( 'In Stock', 'woocommerce' ) . '</p>';
    }
    return $html;
    }

    I have tested this code on my site and it’s working fine. You can use the Code Snippets plugin to add the code:
    https://wordpress.org/plugins/code-snippets/


    If that does not help, I can recommend WooExperts and Codeable.io as options for getting professional help. Alternatively, you can also ask your development questions in the  WooCommerce Community Slack as custom code falls outside our usual scope of support.

    Thread Starter kotisivutohtori

    (@kotisivutohtori)

    Wau, that worked! Thank you so much for this snippet. Much appreciated!

    • Anne
    Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi there!

    Fantastic! I’m thrilled we could resolve this for you quickly. We’d truly appreciate it if you could share your positive experience with others by leaving a 5-star review on WordPress.org: https://wordpress.org/support/plugin/woocommerce/reviews/#new-post

    Thread Starter kotisivutohtori

    (@kotisivutohtori)

    Done!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘“In stock” text is missing for variation if “Manage stock” is not chosen’ is closed to new replies.