Solved

How to remove certain Sort By options on Debut theme?

bexpaints
Explorer
53 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

Accepted Solution (1)
dmwwebartisan
Shopify Partner
12280 2546 3693

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 | #1 Product Filter & Search app on Shopify | The most powerful Shopify page builder app

View solution in original post

Replies 12 (12)

dmwwebartisan
Shopify Partner
12280 2546 3693

@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 | #1 Product Filter & Search app on Shopify | The most powerful Shopify page builder app
bexpaints
Explorer
53 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

dmwwebartisan
Shopify Partner
12280 2546 3693

@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 | #1 Product Filter & Search app on Shopify | The most powerful Shopify page builder app
bexpaints
Explorer
53 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>

 

dmwwebartisan
Shopify Partner
12280 2546 3693

@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 | #1 Product Filter & Search app on Shopify | The most powerful Shopify page builder app
bexpaints
Explorer
53 0 10

Here you go 

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

password: obreur

dmwwebartisan
Shopify Partner
12280 2546 3693

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 | #1 Product Filter & Search app on Shopify | The most powerful Shopify page builder app
bexpaints
Explorer
53 0 10

It worked! thank you so much!

13Akshay
Tourist
3 0 1

thank you for this. its worked

shoptalynne
Visitor
1 0 0

Do I delete any code before adding this code?

 

dmwwebartisan
Shopify Partner
12280 2546 3693

@shoptalynne 

Please share your Sections / collection-template.liquid file 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 | #1 Product Filter & Search app on Shopify | The most powerful Shopify page builder app
winewarehouse
Tourist
14 0 1

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?

 

winewarehouse_2-1644865763664.png