How to remove certain Sort By options on Debut theme?

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

@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,

1 Like

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

@bexpaints

Please share your orignal liquid code .

Thanks!

1 Like

Hi @dmwwebartisan

Below was the original line 108 to 115.

{%- for option in collection.sort_options -%}

{{ option.name }} {%- endfor -%} {% include 'icon-chevron-down' %} {% 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.name }} {% endunless %} {%- endfor -%} {% include 'icon-chevron-down' %}

@bexpaints

Thanks for code . please share your shop URL!

1 Like

Here you go

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

password: obreur

1 Like

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' %} 

{% endunless %}
{%- endfor -%}
1 Like

It worked! thank you so much!

thank you for this. its worked

Do I delete any code before adding this code?

@shoptalynne

Please share your Sections / collection-template.liquid file code

Thanks!

Hi! This is my current drop down. However, I want to add Date, New to Old and Date, Old to New.

Can you please help me?