Forums Forums Search & Filter Pro How to Hide Out of Stock (sold) items from results?

Tagged: 

Viewing 9 posts - 1 through 9 (of 9 total)
  • Anonymous
    #269912

    Hi Trevor,

    Hope you’re well!

    We are wondering if there is a way to hide out of stock items from the search filters, when no taxonomy (category) is selected.

    If a user visits: https://www.usedkitchenexchange.co.uk/shop/

    and then filters price low to high, or vice versa, all the sold kitchens are visible first!

    Like this: https://www.usedkitchenexchange.co.uk/shop/?sort_order=_sfm__price+asc+num

    Many thanks
    Warren

    Trevor
    #269949

    In general, are you showing Out of Stock items in WooCommerce (the catalog) or hiding them? S&F supports the “out of stock visibility” setting in WooCommerce

    Anonymous
    #269975

    Hi Trevor,

    Yes we’re showing them because some rank quite well in search and staff also need to refer back to them after they are sold. I know its not ideal or normal practice, most sites would happily delete sold items.

    Ideally, for us, we would like to be able to hide them from the https://www.usedkitchenexchange.co.uk/shop/ but still be able to browser them here: https://www.usedkitchenexchange.co.uk/product-category/sold/

    Is there a way of doing this?

    Many thanks, Warren

    Trevor
    #270023

    Are you using stock control to decide if it is sold? Or some other custom field? You could add a Post Meta condition using that custom field to show only those not sold (how to do this depends on exactly what data is stored in the database).

    Anonymous
    #270304

    Hi Trevor, sorry for the delayed reply!

    We’re not using stock control ( Manage stock? ). They are marked as ‘Out of Stock’ in the product inventory and also assigned to an ‘Archive – Sold Items’ product category.

    Is there a way to exclude them from the /shop/ page? ( https://www.usedkitchenexchange.co.uk/shop/?sort_order=_sfm__price+asc+num ) but keep them visible here https://www.usedkitchenexchange.co.uk/product-category/sold/

    Trevor
    #270327

    That would require some custom PHP coding then. You would need to use this filter:

    https://searchandfilter.com/documentation/action-filter-reference/#edit-query-arguments

    And make it conditional not only on that form ID (221317) but also only to the shop page (you could check to make sure the page is NOT a Product Category taxonomy page).

    Such custom coding is outside the scope of our technical support, but a competent third party coder should be able to get it done for you. There are some snippets using that filter on our forums, but none doing what you want.

    Anonymous
    #270577

    Okay thanks Trevor

    Trevor
    #270584

    Do let me know if and when I can close this thread?

    Anonymous
    #270586

    Yes sorry please close this now Trevor, many thanks!

Viewing 9 posts - 1 through 9 (of 9 total)