Personalized checkout and custom promotions with Shopify Scripts
I'm wondering if Shopify supports any way of adding new custom sorting objects. Like the sort_option :
{
"name": "Alphabetically, A-Z",
"value": "title-ascending"
}
What I would like to do is add a option to sort by the amount of discount a product has. So sort based on something like this for each product:
{% assign discount = product.compare_at_price | minus: product.price %}
And if this is the proper way of adding a button for that?:
<x-listbox class="popover__value-list"> {%- for sort_option in collection.sort_options -%} {%- if sort_option.name != blank -%} <button type="button" class="popover-listbox__option group" role="option" value="{{ sort_option.value }}" {% if sort_option.value == selected_sort_by_value %}aria-selected="true"{% endif %}> <span class="reversed-link">{{ sort_option.name }}</span> </button> {%- endif -%} {%- endfor -%} <!-- Custom sort option for discount percentage --> <button type="button" class="popover-listbox__option group" role="option" value="discount_percentage"> <span class="reversed-link">Sort by discount</span> </button> </x-listbox>
Hi,
They have not given you an answer for 16 months, but this is something we are also very curious about. We are also very curious if there is an App about this. All apps seem to be playing in the Collections, but we could not understand which app we want exactly. If you have a working code or an app you use about the discount rate ranking, I would appreciate it if you share it.
I wish you a good day and good work.
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025