How to remove certain Sort By options on Debut theme?

Solved
bexpaints
Excursionist
51 0 10

Hello,

I'm using the debut theme and want to remove 'Featured, Best Selling, Date old to new, Date new to old' options. Please can someone help?

Thanks

Screenshot 2021-07-15 at 12.15.26.png

0 Likes
dmwwebartisan
Shopify Partner
7310 1727 2303

@bexpaints 

  • Go to Online Store > Actions > Duplicate. The reason for this being that you can make this edit on the duplicate and then publish it when you are sure it has worked.
  • Beside "Copy of Debut" click Actions > Edit Code.
  • Go to Sections > collection-template.liquid.
  • In line 124 locate the following: {%- for option in collection.sort_options -%}
  • Under this you will put the following code:
{% unless option.value == 'manual' or option.value == 'title-ascending' or option.value == 'title-descending' or option.value=='created-ascending' or option.value == 'created-descending' %}
  • On the line under this code add {% endunless %}
  • The finished code will look like this: 
                      {%- for option in collection.sort_options -%}{% unless option.value == 'manual' or option.value == 'title-ascending' or option.value == 'title-descending' or option.value=='created-ascending' or option.value == 'created-descending' %}
                        <option value="{{ option.value }}" {% if option.value == sort_by %}selected="selected"{% endif %}>{{ option.name }}</option>
                      {% endunless %}
                      {%- endfor -%}
  • Click Save and Preview the theme. If you are happy with how it looks, you can publish it! 

Let me know how this goes and if there is anything else I can assist you with, I'm happy to help!

 

All the Best,

If helpful then please Like and Accept Solution | Email: dmw.webartisan@gmail.com | Instagram: @dmw.webartisan
Check here PageFly App to customize your pages | Bag is a cart drawer that maximizes your sales. View app →
bexpaints
Excursionist
51 0 10

hi @dmwwebartisan 

I ended up just copying your final code near line 108 which kind of worked, but I am missing the Alphabet A - Z and Z - A option, and it is still showing 'Best selling' which I want removed

 

thanks

 

Screenshot 2021-07-15 at 12.41.47.png

0 Likes
dmwwebartisan
Shopify Partner
7310 1727 2303

@bexpaints 

Please share your orignal liquid code .

Thanks!

If helpful then please Like and Accept Solution | Email: dmw.webartisan@gmail.com | Instagram: @dmw.webartisan
Check here PageFly App to customize your pages | Bag is a cart drawer that maximizes your sales. View app →
bexpaints
Excursionist
51 0 10

Hi @dmwwebartisan 

Below was the original line 108 to 115.

{%- for option in collection.sort_options -%}
<option value="{{ option.value }}" {% if option.value == sort_by %}selected="selected"{% endif %}>{{ option.name }}</option>
{%- endfor -%}
</select>
{% include 'icon-chevron-down' %}
</div>
</div>
{% endif %}

Below is the new 108 to 115 as per your code.

{%- for option in collection.sort_options -%}{% unless option.value == 'manual' or option.value == 'title-ascending' or option.value == 'title-descending' or option.value=='created-ascending' or option.value == 'created-descending' %}
<option value="{{ option.value }}" {% if option.value == sort_by %}selected="selected"{% endif %}>{{ option.name }}</option>
{% endunless %}
{%- endfor -%}
</select>
{% include 'icon-chevron-down' %}
</div>
</div>

 

0 Likes
dmwwebartisan
Shopify Partner
7310 1727 2303

@bexpaints 

Thanks for code . please share your shop URL!

 

 

If helpful then please Like and Accept Solution | Email: dmw.webartisan@gmail.com | Instagram: @dmw.webartisan
Check here PageFly App to customize your pages | Bag is a cart drawer that maximizes your sales. View app →
bexpaints
Excursionist
51 0 10

Here you go 

https://bex-paints.myshopify.com/

password: obreur

dmwwebartisan
Shopify Partner
7310 1727 2303

This is an accepted solution.

Add following code 

 {%- for option in collection.sort_options -%}
 {% unless option.value == 'manual' or option.value == 'best-selling' or option.value == 'created-ascending' or option.value=='created-descending' %} 
<option value="{{ option.value }}" {% if option.value == sort_by %}selected="selected"{% endif %}>{{ option.name }}</option>
{% endunless %}
{%- endfor -%}
If helpful then please Like and Accept Solution | Email: dmw.webartisan@gmail.com | Instagram: @dmw.webartisan
Check here PageFly App to customize your pages | Bag is a cart drawer that maximizes your sales. View app →
bexpaints
Excursionist
51 0 10

It worked! thank you so much!

0 Likes