How to remove sort menu options using the Debut theme?

Hi,

I’d like to remove the options on the sort menu of my Shopify store using the debut team, as I find it too cluttering.

2 Likes

Hey there, @Anonymous

Bo here from Shopify Support!

This is a great question and the desired effect can be achieved with a little code. This tutorial is specific to an unedited version of the Debut theme, (VERSION 11.2.0). We cannot guarantee results for themes that have been modified with custom coding and/or apps. We suggest hiring a Shopify Expert if you are not comfortable proceeding with the following tutorial, or wish to make any variations to this tutorial.

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

Bo

4 Likes

I’d like to remove the two sort by price options in the debut theme. What code would I use to get that done?

1 Like

Hey there, @grasshopper

  • To do this, follow all of the steps above and substitute the code mentioned with the following under line 124:
{% unless option.value == 'price-ascending' or option.value=='price-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 == 'price-ascending' or option.value=='price-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,

Bo

1 Like

Thanks, that’s what I thought it would be but just wanted to confirm the syntax. Worked like a charm. (You missed a closing single quote, but I added it in). I appreciate the quick response.

Hi Bo or Shopify Staff member,

How do I remove best-selling from the filter?

Hey there, @ARTSKUL

Bo here from Shopify Support!

Great question. This will be done a little differently than the changes above. We will instead be adding some code to the very bottom of the theme.scss.liquid.

NB When editing the CSS of your theme it is always a good idea to duplicate your theme first and making the changes on the duplicate. This will prevent any errors from occurring on your live site. We also recommend adding CSS to the bottom of the file as opposed to altering the preexisting code. The new code will overwrite the previous code.

Go to Online Store > Actions > Edit Code. Open the Assets Folder > theme.scss.liquid and scroll to the very bottom of the file. Add the following code:

#SortBy {
  option[value=best-selling] {
    display: none;
  }
}

Click Save.

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,

Bo

Thanks Bo ?

d

1 Like

Hi! I wanted to add in an ‘availability’ sort by option so that customers can sort to have in stock items first. I’m using Sunrise theme - anyone know if there’s a way to do this?

Thank you!

But when collection page opens, it shows sorting by default “best selling” how to change by default sort by settings

Hey there, @MayurBaldha

This can be updated in the admin, just switch to a different filter option in the collection itself:

So, you will need to go to the Admin > Products > Collections and then change the sort by in your collections to be anything but Best Selling - this will remove it as an option in the collections after you have made the theme change.

All the Best,

Bo

1 Like

EDIT: I found the painfully obvious solution in customizer. I’d delete this post if there was an option for it.

I did this and it did not work.

In my Debut theme, the {%- for option in collection.sort_options -%} code is on line 110. Everything else covered in the tutorial is the same. I have not edited this page before. Any idea? My goal is to totally remove the sorting options because I only have 2 items.

Thanks

Hi Bo,

I have traed to change my code with your instructions but in my code does not appear. can you help me, i am in the Brooklyn theme! thanks

Instead it look like this:

{%- if section.settings.show_collection_image and collection.image -%}

{%- assign img_url = collection.image | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%} {%- comment -%} If the collection.image height is < 70% of its width on mobile or < 45% on desktop, we crop the container to make sure it's the same height as the image. {%- endcomment -%} {%- assign height_width_ratio = 100 | divided_by: collection.image.aspect_ratio | floor -%} {%- if height_width_ratio < 70 -%} {%- if height_width_ratio < 45 -%} .collection-hero__image-wrapper::after { padding-bottom: {{ height_width_ratio }}%; } {%- else -%} @media screen and (max-width: 768px) { .collection-hero__image-wrapper::after { padding-bottom: {{ height_width_ratio }}%; } } {%- endif -%} {%- endif -%}
{{ collection.image.alt | escape }}
{%- endif -%}
{%- paginate collection.products by 12 -%}

{{ collection.title }}


{%- if collection.description != blank -%}
{{ collection.description }}
{%- endif -%}
{%- if section.settings.collection_sort_enable -%} {%- include 'collection-sorting' -%} {%- endif -%}

{%- if section.settings.collection_tags_enable -%}
{%- if collection.all_tags.size > 0 -%}
{%- if section.settings.collection_sort_enable -%}


{%- endif -%}
    {% comment %} Used for the catalog collection (/collections/all) and product collections (collections/{collection.handle}) {% endcomment %} {{ 'collections.general.all_of_collection' | t }}

    {%- for tag in collection.all_tags -%}
    {%- if current_tags contains tag -%}

  • {{ tag | link_to_remove_tag: tag }}
  • {%- else -%}
  • {% comment %} Use link_to_add_tag if you want to allow filtering by multiple tags {% endcomment %} {{ tag | link_to_tag: tag }}
  • {%- endif -%} {%- endfor -%}
{%- endif -%} {%- endif -%}

{%- if section.settings.collection_tags_enable -%}


{%- endif -%}

{%- if section.settings.collection_products_grid == ‘collage’ -%}

{% comment %} Loop through our products in the current collection. See the snippet 'snippets/product-grid-collage.liquid'.

is_reverse_row__product, three_row_index__product, collection_product_count, and divisible_by_three__product are
all used by ‘snippets/product-grid-collage.liquid’
{% endcomment %}
{%- assign is_reverse_row__product = false -%}
{%- assign three_row_index__product = 0 -%}
{%- assign collection_product_count__product = collection.products.size -%}
{%- assign divisible_by_three__product = collection_product_count__product | modulo:3 -%}
{%- for product in collection.products -%}
{%- include ‘product-grid-collage’ -%}
{%- else -%}

{%- if shop.products_count == 0 -%}
{% comment %}
Add default products to help with onboarding for collections/all only
{% endcomment %}
{% include ‘onboarding-featured-products’ -%}
{%- else -%}
{% comment %}
If collection exists but is empty, display message
{% endcomment %}

{{ 'collections.general.no_matches' | t }}

{%- endif -%} {%- endfor -%}
{%- elsif section.settings.collection_products_grid == 'grid' -%}
{%- assign grid_item_width = 'medium--one-half large--one-third' -%} {%- for product in collection.products -%} {%- include 'product-grid-item' -%} {%- else -%} {%- if collection.handle == 'all' -%} {% comment %} Add default products to help with onboarding for collections/all only {% endcomment %} {%- include 'onboarding-featured-products' -%} {%- else -%} {% comment %} If collection exists but is empty, display message {% endcomment %}

{{ 'collections.general.no_matches' | t }}

{%- endif -%} {%- endfor -%}
{%- endif -%}

{%- if paginate.pages > 1 -%}
{%- include ‘pagination’ -%}
{%- endif -%}

{%- endpaginate -%}

{% schema %}

Hi! i made it for Brooklyn theme you have to do it in the snippet carpeta and not the section one :slight_smile:

Thank you, your post was very helpful!

how do i remove my post?

Bo,

I do not know if you are still with support at shopify…but I have this same exact issue with the theme NARRATIVE.

Would I follow the exact code you provided from 2019?

I sell chocolates and want to remove the date, old to new / date, new to old

options on the dropdown bar??

Date, old to new Date, new to old

Thank you so much for any help you may offer,

Heather

Hi Bo,

Any idea how I can make my “sort by” options longer width on mobile view? My url is: nutraesse.com

Currently, it looks like this:

Hi Bo - is this still the appropriate solution for the debut theme to refine the “sort by” menu? Thanks! I’m trying to eliminate alphabetical sorting from my shop as it’s not cohesive for my products.

MSotherden

Hello!

is there a solution working with the current debut theme? The solution provided here from 2019 does not seem to work anymore.

Thanks so much!

how do I remove sort by color option?