Hiding out of stock products from the shopify search?

PB79
Excursionist
39 1 10

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

 

0 Likes
Megantaur
Tourist
4 0 0

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”. 

0 Likes
PB79
Excursionist
39 1 10

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.

0 Likes
Megantaur
Tourist
4 0 0

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

0 Likes
PB79
Excursionist
39 1 10

Help would really be appreciated

0 Likes

Hi @PB79 

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

0 Likes