Hiding out of stock products from the shopify search?

PB79
Pathfinder
120 2 40

Hi!

it would be very nice if someone could tell me how to hide sold out products within the shopify search.

i could just archivate every sold out product but then they also disappear from the customer order histories.

ive already searched the forums and found this tip:

https://www.huratips.com/tech-tips/how-to-hide-sold-out-products-from-search-results-in-shopify.html

 

  • From your Shopify admin, go to Online Store > Themes.
  • Find the theme you want to edit, and then click Actions > Edit code.
  • In the Templates directory, click search.liquid to open it in the online code editor.
  • Find to the loop {% for item in search.results %} and {% endfor %}.
  • Add an IF statement between this FOR loop.
  • Click Save and you’re done.

 

But i cant find this code in my custom porto theme.

 

I would really appreciate a helping hand 🙂

 

Have a nice day and take care

Phil

 

Replies 7 (7)

Megantaur
Tourist
4 0 1

when my product is out of stock I would click the product from my shopify account and changed it to draft from active, you can look up the “active”button and just change it to “draft”. 

PB79
Pathfinder
120 2 40

Setting products to draft or archiving them hides them from the store thats correct but not a solution because they also get hidden/deleted from the customer order histories leaving not clickable links witout an image. An thats what i dont want. i only want out of stock to be hidden in search.😞

Megantaur
Tourist
4 0 1

Oooh I didn’t know that, sorry. I just made the store a few days ago. 

PB79
Pathfinder
120 2 40

Help would really be appreciated 🙂

aamirk
Shopify Partner
20 1 4

Hi @PB79 

Would it be easier to make the code change in theme if products that are out of stock have a specific tag?

hacketyapps
Shopify Partner
38 2 5

This app Delist Automation can help with that, set a delist rule to unpublish products which removes the product from stores but doesn't archive/delete it.

SimpleCell
Shopify Partner
2 0 0

First install the Search & Discovery App in Shopify.

 

Search & Discovery App > App Settings > Out of stock products > Select 'Not at all'