Forums › Forums › Search & Filter Pro › How to Hide Out of Stock (sold) items from results?
Tagged: woocommerce
- This topic has 8 replies, 2 voices, and was last updated 4 years ago by Anonymous.
-
Anonymous(Private) December 15, 2020 at 5:46 pm #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
WarrenAnonymous(Private) December 16, 2020 at 1:09 pm #269975Hi 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
Anonymous(Private) December 18, 2020 at 4:42 pm #270304Hi 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(Private) December 18, 2020 at 5:16 pm #270327That 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.
-
AuthorPosts