Shopify themes, liquid, logos, and UX
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? 🙂
Solved! Go to the solution
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
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
Thank you!!
This solution works for the first time. Once I select the sort options say (price, low to high), disabled options come back. What would efficient event to listen?
As 2024 wraps up, the dropshipping landscape is already shifting towards 2025's trends....
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024