Sort Sold Out products at the end of Collection

Sort Sold Out products at the end of Collection

Sabih_Nawaz
Tourist
10 0 1

Hi,

I'm using Prestige theme,
I want to push sold out product at the end of collection page.

My store URL is www.armansonline.com
Your help is really appreciated.

Thank You! 

Replies 5 (5)

MastersHub
Shopify Partner
216 21 38

Hi @Sabih_Nawaz 

 

You need to modify the code in the collection.liquid section like this. Codes may vary depending on the theme, but the main logic is like this. If you know how to code, customize it according to your needs.

 

 

<div class="ProductListWrapper">
        <div class="ProductList ProductList--grid {% if paginate.pages > 1 %}ProductList--removeMargin{% endif %} Grid" data-mobile-count="{{ mobile_items_per_row }}" data-desktop-count="{{ desktop_items_per_row }}">
          {%- for product in collection.products -%}
            {%- if product.available == true -%}
              <div class="Grid__Cell 1/{{ mobile_items_per_row }}--phone 1/{{ tablet_items_per_row }}--tablet-and-up 1/{{ desktop_items_per_row }}--{% if section.settings.filter_position == 'drawer' %}lap-and-up{% else %}desk{% endif %}">
                {%- render 'product-item', product: product, show_product_info: true, show_vendor: section.settings.show_vendor, show_color_swatch: section.settings.show_color_swatch, show_labels: true -%}
              </div>
            {% endif %}
          {%- endfor -%}

          <!--     For sold out products       -->
            {%- for product in collection.products -%}
              {%- if product.available == false -%}
                <div class="Grid__Cell 1/{{ mobile_items_per_row }}--phone 1/{{ tablet_items_per_row }}--tablet-and-up 1/{{ desktop_items_per_row }}--{% if section.settings.filter_position == 'drawer' %}lap-and-up{% else %}desk{% endif %}">
                  {%- render 'product-item', product: product, show_product_info: true, show_vendor: section.settings.show_vendor, show_color_swatch: section.settings.show_color_swatch, show_labels: true -%}
                </div>
              {% endif %}
            {%- endfor -%}
          <!--     End sold out products      -->
        </div>
        
      </div>

 

 

Helpful ? Like and Accept Solution
Buy me a Coffee
Need a Shopify Developer?
Send Email or Chat on WhatsApp
Sabih_Nawaz
Tourist
10 0 1

I'm Using Prestige theme, this code is not working on my collection.liquid
I don't know how to customize the code.

MastersHub
Shopify Partner
216 21 38

I can't make edits because I can't see the theme codes. If have any questions let me know so I can clarify, and if not, and you'd like to work together please feel free to message me directly.

Helpful ? Like and Accept Solution
Buy me a Coffee
Need a Shopify Developer?
Send Email or Chat on WhatsApp
Hessy_aleey
Visitor
1 0 0
Im ready to work with you
Dev441
Shopify Partner
9 0 0

Hey this code works , but I have a pagination so in that case it is sorting first page as per condition and I want all available products first and sold out at last page only. Any idea how is it possible for pagination? @MastersHub