Solved

Remove some options from "Sort By" - Sense theme

Iris27
Tourist
10 0 2

I would like to remove the following sort by options on my website (www.studioyouka.nl) (SENSE theme):

Alphabetical - A-Z
Alphabetical - Z-A
Date - Old to new

Can somebody tell me which code I need to use? 🙂

Accepted Solution (1)

ThePrimeWeb
Shopify Partner
2127 608 473

This is an accepted solution.

Hey @Iris27,

 

Go to your theme's "Edit Code" Option, then in the search bar type "theme.liquid"
Above the tag "</body>" tag paste the following. Screenshot attached for reference.

 

<script>
document.addEventListener('DOMContentLoaded', function() {
    try {
        const sortBySelect = document.querySelectorAll('select[name="sort_by"] option');

        for (const option of sortBySelect) {
        
          if (option.value === "title-ascending" || option.value === "title-descending" || option.value === "created-ascending") {
            option.remove();
          }
        }
    } catch {}
});
</script>

 

Screenshot for reference  

ThePrimeWeb_0-1712654812651.png

 

Was I helpful?

Buy me a coffee

🙂

Need help with your store? contact@theprimeweb.com or check out the website
Check out our interview with Shopify!

View solution in original post

Replies 2 (2)

ThePrimeWeb
Shopify Partner
2127 608 473

This is an accepted solution.

Hey @Iris27,

 

Go to your theme's "Edit Code" Option, then in the search bar type "theme.liquid"
Above the tag "</body>" tag paste the following. Screenshot attached for reference.

 

<script>
document.addEventListener('DOMContentLoaded', function() {
    try {
        const sortBySelect = document.querySelectorAll('select[name="sort_by"] option');

        for (const option of sortBySelect) {
        
          if (option.value === "title-ascending" || option.value === "title-descending" || option.value === "created-ascending") {
            option.remove();
          }
        }
    } catch {}
});
</script>

 

Screenshot for reference  

ThePrimeWeb_0-1712654812651.png

 

Was I helpful?

Buy me a coffee

🙂

Need help with your store? contact@theprimeweb.com or check out the website
Check out our interview with Shopify!
Iris27
Tourist
10 0 2

Thank you!!