Shopify themes, liquid, logos, and UX
Hi
I had pasted a code in theme.liquid to delete some items from the "Sort by" menu.
The code is working fine when im checking from my system(windows) and phone(android) but when i check from my friends Macbook and iPhone, the sort by options are still there. (Please check images attached)
The code i used :
<style> option[value="title-ascending"], option[value="best-selling"], option[value="title-descending"], option[value="created-ascending"], option[value="created-descending"] { display: none !important; } </style>
Check Images
1) "Sort by" as seen from my system
2) "Sort by" seen from Macbook
Hi @CNDY_123
You're doing it using CSS, so it might still appear when searching from a friend’s phone or desktop. This could be due to reasons like cached webkets, etc
To remove the sort option in the Dawn theme, follow these steps:
look for the sort code, which should resemble the following:
<select
name="sort_by"
class="facet-filters__sort select__select caption-large"
id="SortBy"
aria-describedby="a11y-refresh-page-message"
>
{%- for option in collection.sort_options -%}
<option
value="{{ option.value | escape }}"
{% if option.value == sort_by %}
selected="selected"
{% endif %}
>
{{ option.name | escape }}
</option>
{%- endfor -%}
</select>
Carefully replace this with this:
<select
name="sort_by"
class="facet-filters__sort select__select caption-large"
id="SortBy"
aria-describedby="a11y-refresh-page-message"
>
{%- for option in collection.sort_options -%}
{%- unless option.value == "title-ascending" or option.value == "best-selling" or option.value == "title-descending" or option.value == "created-ascending" or option.value == "created-descending" -%}
<option
value="{{ option.value | escape }}"
{% if option.value == sort_by %}
selected="selected"
{% endif %}
>
{{ option.name | escape }}
</option>
{%- endunless -%}
{%- endfor -%}
</select>
If you have any problem let me know
-If this solution helps you, kindly LIKE THIS REPLY and MARK AS A SOLUTION OR
-If you need an expert Shopify developer for customization and development, feel free to contact me.
Email: Mehran.ali5300@gmail.com
WhatsApp: +92 343 0211536
Okay i can check that if you can share the collaboration code to me
-If this solution helps you, kindly LIKE THIS REPLY and MARK AS A SOLUTION OR
-If you need an expert Shopify developer for customization and development, feel free to contact me.
Email: Mehran.ali5300@gmail.com
WhatsApp: +92 343 0211536
hi @Mehran_Ali
The above code actually worked...The issue was only with one system...when checked from another systems the issue is not there...
Thank You for your valuable time!
great if the above sooution working kindly mark it as solution
-If this solution helps you, kindly LIKE THIS REPLY and MARK AS A SOLUTION OR
-If you need an expert Shopify developer for customization and development, feel free to contact me.
Email: Mehran.ali5300@gmail.com
WhatsApp: +92 343 0211536
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024