Sort Products by Availability in the Collection

Sort Products by Availability in the Collection

Log in or Sign up to ensure access to purchased code across multiple devices.

How to see the code

1. Please log in/create an account first. This is to ensure that all purchases are connected to an account and can be viewed on different devices.

2. Purchase the code using the "purchase box" on the specific page of the desired code.

3. After the purchase, please refresh the page.

Compatibility: Dawn and other  Shopify 2.0 FREE themes

How we wish we can sort the products in the collection using availability but this is possible with just a few lines of code. Show the available products first with NO APP needed.

If you are using paid Shopify themes, you can hire me for $30 implement the code.

 What you are buying:

  • Show available products first then the out of stock
  • Works with filter

What makes our code better:

  • We do not use external libraries, with that being said, our code will have no to minimal effect to your website's speed performance
  • We do not leave or add codes use to advertise for our website
  • Our code is mobile friendly

Any issues related to the code will be fix with no additional cost, excluding code customization requests. Simply contact us with "Chat with us." We are just a button away. 

To start:

1. From your Admin Page, click Online Store > Themes >Actions > Edit code
2. In the Section folder, open the "main-collection-product-grid"
3. Find the {%- for product in collection.products -%}, then place the code below above it.

4. Change the collection.products to sortedProducts in the forloop. See the image below

sort available

5. Click SAVE

 

That is it (",)

Copied!
Back to blog

Leave a comment