• Resolved itsadesignthing

    (@itsadesignthing)


    Dear WooCommerce,

    The filters on our website do not seem to take into account the stock of a product.
    A client can click on size=”M” and see the filtered products.

    However, these are all the products having the attribute size=”M” assigned to them. Even if their attribute stock=0.
    As a result, the client filters on size=”M” and goes to a product. However, when trying to buy it, it’s not available in the requested size…

    Could you please advise how to resolve this with perhaps some custom code?

    Thank you.

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Mirko P.

    (@rainfallnixfig)

    Hello @itsadesignthing 👋

    The filter retrieves all products with the specific attribute term regardless of stock status.

    If you want out of stock products to be hidden when you use the filter you need to enable “Hide out of stock items from the catalog” next to Out of stock visibility in WooCommerce > Settings > Products > Inventory.

    Let us know if you have more questions.

    Thread Starter itsadesignthing

    (@itsadesignthing)

    Hi Mirko,

    Thank you for your reply!

    That option is indeed enabled, but that makes the issue even worse. A user can filter out a size and see the related products. But these product don’t actually have that size available which makes it seem “buggy”.

    So the question is about: how do I make sure the filter takes into account the stock of those attributes?

    Thanks!

    Mirko P.

    (@rainfallnixfig)

    Hi @itsadesignthing,

    But these product don’t actually have that size available which makes it seem “buggy”.

    This could be an indication of a conflict on your site. You will want to do a conflict test to see if the issue is caused by a plugin/theme conflict with WooCommerce.

    Here are the steps for doing a conflict test: https://docs.woocommerce.com/document/how-to-test-for-conflicts/

    how do I make sure the filter takes into account the stock of those attributes?

    Out of the box WooCommerce doesn’t have a function to filter by stock status. For such a feature, you’d need to look for an extension such as WooCommerce Product Search which has a stock filter included, or other filter plugins sold by independent developers.

    Cheers.

    Thread Starter itsadesignthing

    (@itsadesignthing)

    Marking this ticket as solved. Not because its actually solved, but since there is no solution. 🙂

    Anyway, thank you for the quick responses!

    Thread Starter itsadesignthing

    (@itsadesignthing)

    FYI, I found this article where it is explained that this is a bug:
    https://developer.woocommerce.com/2021/08/12/brace-yourselves-new-product-filtering-by-attributes-is-coming/

    After adding the snippet, I received a critical error and had to use a backup, so also not really a solution. 🙂

    But ok…

    Mirko P.

    (@rainfallnixfig)

    Hi @itsadesignthing,

    Thanks for doing your research and posting the Github issue.

    It appears that developers are working on this but there is no date yet to implement the variation filtering which will solve multiple issues, including the one you reported.

    Please feel free to subscribe and follow updates directly in Github:

    https://github.com/woocommerce/woocommerce/issues/29611

    Cheers.

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

The topic ‘Filter on variations, taking into account stock’ is closed to new replies.