How to hide out of stock products in dawn theme

Solved

How to hide out of stock products in dawn theme

CHICXCHIC
Shopify Partner
19 0 2

Without app, how can I hide products which are unavailable in dawn theme the latest version? I’ve tried many other methods but they all aren’t applied to the latest version in dawn. Please help me.

Accepted Solution (1)

Kani
Shopify Partner
468 125 232

This is an accepted solution.

Hi @CHICXCHIC 

 

if you just have few sold out products. here is a simple way for you to make it.

1: Online store > themes > Actions > Edit code > Sections > main-collection-product-grid.liquid

2: find ' {%- for product in collection.products -%} ' ( if you have not edited code before, it's at line 104)

Kani_0-1661569698625.png

 

3: paste code after '{%- for product in collection.products -%}' , just like image above.

 

{%- if product.available == false -%}
      {%- continue -%}
{%- endif -%} 
Copy

 

 4: Save and refresh you colleciton page, it may need refresh more than one time or wait a few second

Hey!! ʕ ᵔᴥᵔ ʔ
Please click 'Like' and ' Accept as Solution' to encourage me to continue sharing my expertise. ♡
If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response. 🙂

View solution in original post

Replies 8 (8)

Kani
Shopify Partner
468 125 232

This is an accepted solution.

Hi @CHICXCHIC 

 

if you just have few sold out products. here is a simple way for you to make it.

1: Online store > themes > Actions > Edit code > Sections > main-collection-product-grid.liquid

2: find ' {%- for product in collection.products -%} ' ( if you have not edited code before, it's at line 104)

Kani_0-1661569698625.png

 

3: paste code after '{%- for product in collection.products -%}' , just like image above.

 

{%- if product.available == false -%}
      {%- continue -%}
{%- endif -%} 
Copy

 

 4: Save and refresh you colleciton page, it may need refresh more than one time or wait a few second

Hey!! ʕ ᵔᴥᵔ ʔ
Please click 'Like' and ' Accept as Solution' to encourage me to continue sharing my expertise. ♡
If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response. 🙂
CHICXCHIC
Shopify Partner
19 0 2

Thank you so so much! can you help me make out of stock products go to last page as well? Instead of hiding?

Kani
Shopify Partner
468 125 232

huh, I think it may impossible to make it simply via liquid ? (you can only get products of current page)

so you should manually edit it on collection.( or using some app to help you did those jobs 🙂

Hey!! ʕ ᵔᴥᵔ ʔ
Please click 'Like' and ' Accept as Solution' to encourage me to continue sharing my expertise. ♡
If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response. 🙂
CHICXCHIC
Shopify Partner
19 0 2

Okay then no problem thank you very much! I really appreciate your advice!

StockInMotion
Shopify Partner
8 0 0

Why hide out of stock items when you can now sell them in transit!  Please take a look at our new application "Stock In Motion" and start selling instead of hiding!!

 

Stock In Motion - Sell inbound inventory prior to arrival at fulfillment centers | Shopify App Store

diego_ezfy
Shopify Partner
2971 571 923

Hi,

The main issue when hiding the out of stock products with liquid/CSS is that it's going to leave one or more blank spot(s) at the ending:

diego_ezfy_0-1666605416882.png

Ideally you must render all "out of stock" products and then show them.

I wrote a tutorial here showing how to achieve that. 

It will work on all of the free Shopify themes as well, not only Dawn.

Let me know if you need any further assistance.

Kind regards,
Diego

Max-Baldini
Shopify Partner
4 0 1

Hello, @diego_ezfy 

I tried to create the snippet from your tutorial  and insert it in my site developed with Dawn, but it doesn't work, could you help me?

 

Here two collections with sold out products:

https://pgservice.cc/collections/remington
https://pgservice.cc/collections/all

Thank you in advance

DelightCart
Shopify Partner
1271 84 158

@CHICXCHIC May this help you to hide products. Click Here.

Delight Cart - It's time to turn your visitors into loyal shoppers! 

Delight Loyalty - Increase repeat sales quickly and build lifelong customers loyalty.