How do i delete one of the options on the SortBy dropdown menu?

I want to get rid of the alphabetical options and the date options but can’t find the code to do so. Can anyone help me out?

Thank you in advance!

Hi,

I think its Boundless theme if so then follow bellow:

  1. Go to Online Store->Theme->Edit code
  2. Section->collection-template.liquid->find id=“SortBy” and remove option from here and save.

Note:If not then send me your store URL and theme name.

Let me know if you want help.

1 Like

That would be only if I wanted to delete the entire thing but I only want to delete a few options.

Website URL: Fucsun.com

theme: Boundless

Yes, from this instruction you can remove any option from select box.

You can see like this on page:

 <select name="SortBy" id="SortBy" data-value="{{ collection.sort_by | default: collection.default_sort_by | escape }}">
          <option value="manual">{{ 'collections.sorting.featured' | t }}</option>
          <option value="best-selling">{{ 'collections.sorting.best_selling' | t }}</option>
          <strong><option value="title-ascending">{{ 'collections.sorting.az' | t }}</option>
          <option value="title-descending">{{ 'collections.sorting.za' | t }}</option></strong>
          <option value="price-ascending">{{ 'collections.sorting.price_ascending' | t }}</option>
          <option value="price-descending">{{ 'collections.sorting.price_descending' | t }}</option>
          <option value="created-descending">{{ 'collections.sorting.date_descending' | t }}</option>
          <option value="created-ascending">{{ 'collections.sorting.date_ascending' | t }}</option>
   </select>

Remove bellow line from above code

<option value="title-ascending">{{ 'collections.sorting.az' | t }}</option>
<option value="title-descending">{{ 'collections.sorting.za' | t }}</option>

Let me know if you need help.

I’m not given that option mine says this

Change like this:

{% for option in collection.sort_options %}
    **{% unless option.value contains 'title-ascending' or option.value contains 'title-descending'  %}**
        <option value="{{ option.value }}" {% if sort_by == option.value %} selected="selected" {% endif %}>{{ option.name }} </option>
    **{% endunless%}**
{% endfor%}

Note: just add unless and endunless condition

Let me know if need help.

3 Likes

Thanks, your answer was of great help to me.

I am new to Shopify and don’t know much about it, so my first approach was to edit ‘sort_options’ object from which the for loop is extracting all the options but I couldn’t find where all the data is defined. It would be very helpful if you could tell me where is this ‘collection’/‘sort_options’ object stored or from where this theme is pulling all its data.

Thanks in advance.

Hi @arpitbanati

You can find this code in

  1. Go to Online Store->Theme->Edit code
  2. Section->collection-template.liquid->find id=“SortBy”

Hi there,

I wanted to remove “Featured” from my drop down menu. I followed your instructions, but I can’t seem to find this line item in the code.

Would you be able to help me? Let me know what you need from me.

Thanks!

You can find this code in :

  1. Go to Online Store->Theme->Edit code
  2. Section->collection-template.liquid->find id=“SortBy”

Then place this code instead of liquid and manage this as you want or any change

<select name="SortBy" id="SortBy" data-value="{{ collection.sort_by | default: collection.default_sort_by | escape }}">
          <option value="manual">{{ 'collections.sorting.featured' | t }}</option>
          <option value="best-selling">{{ 'collections.sorting.best_selling' | t }}</option>
          <strong><option value="title-ascending">{{ 'collections.sorting.az' | t }}</option>
          <option value="title-descending">{{ 'collections.sorting.za' | t }}</option></strong>
          <option value="price-ascending">{{ 'collections.sorting.price_ascending' | t }}</option>
          <option value="price-descending">{{ 'collections.sorting.price_descending' | t }}</option>
          <option value="created-descending">{{ 'collections.sorting.date_descending' | t }}</option>
          <option value="created-ascending">{{ 'collections.sorting.date_ascending' | t }}</option>
   </select>

Hello I also want to delete some options from this dropdown menú, I am using Brooklyn theme. I want to just leave: feature, best selling, price low to High and Price High to los, thats it. When i search the code like “sort by” appears to me like this, so I dont see how can I erase the rest of the options. Can you please help me?

{%- if section.settings.collection_sort_enable -%} {%- include 'collection-sorting' -%} {%- endif -%}

Thanks :slight_smile:

I have already shred solution for that, you have to remove you theme code for that and replace with it my given HTMl code and remove option that you dont want.

Hi Jasoliya,

Thank you for answering but the answer you had given before dosent apply to the Brooklyn theme. First because the sort by section is in snippet and when i paste the code you talked about it appear to me like an error. Like:

Translation missing en.collections.sortings.az

Can you please help me understand what am i doing wrong?

Thanks a lot. :slight_smile:

Which theme you have?

Hi, I see you can delete the option from the SortBy dropdown menu, I am hoping to add one to sort my collection by instock and out of stock.

Is it possible?

No this is not possible because shopify cant filter product by availability. for that you have to manage it by custom code.

How would I do that? Is it something i can do on my own, or a script has been written for this?

No you cant do by your self for that you must need to contact developer its custom work not easy.

How can I change the possibilities, when I have this code:

{{ ‘collections.sorting.title’ | t }}

The problem is: When i put your code in, I get this:

Translation missing en.collections.sortings.az

Try this

<select name="SortBy" id="SortBy" data-value="{{ collection.sort_by | default: collection.default_sort_by | escape }}">
          <option value="manual">manual</option>
          <option value="best-selling">best selling</option>
          <option value="title-ascending">title ascending</option>
          <option value="title-descending">title descending</option>
          <option value="price-ascending">price ascending</option>
          <option value="price-descending">price descending</option>
          <option value="created-descending">reated descending</option>
          <option value="created-ascending">created ascending</option>
   </select>