Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi there. I could not find a solution to this. I am building a vintage baseball card shop where I sell single cards for a variety of different years.
I'm breaking each set/year into its own collection and I need to show the cards in numerical order. Each product is named using the convention "Card # Player Name" for each collection. For example, in the collection “1965 Topps Baseball” I have a product called “350 Mickey Mantle”.
The issue I am having is that there seems to be no sort option for numerical order. When I sort alphabetically the cards will display out of order .... i.e. in the order 1,2,3,4,5,6,7,8,9,10 then 100,101,102 etc. Is there a way I can fix this so the product order is numerical?
Hello @JKSportsCards ,
Only JS is solution for it.
Idea it, first you have to split the title just to get the numeric value from the title. Once you get it then use it with data attribute. After that write a simple script which will sort your products loop in numeric order on page load.
script example
var divList = $(".product-index");
divList.sort(function(a, b){ return $(a).data("listing-sort")-$(b).data("listing-sort")});
$(".loop_parent").html(divList);
'.loop_parent' is parent class of loop.
'listing-sort' is a data attribute
'.product-index' class of each product parent element
Thanks
I shared an example and idea to implement. It's not a solution.
You have to write code a/to the theme you are using and the setup you have.
Hi @JKSportsCards,
This is impossible. Shopify does not support this in admin and theme, you can only install the app.
Refer https://apps.shopify.com/search?q=Collection%20Sort
Hope you can find the app you need. Or you can contact Shopify for support: https://help.shopify.com/en/questions#/contact
And if you sort by JS, it won't work with pagination.
Hope it helps!
JS sort works with infinite scroll.
Hi @Guleria,
'infinite scroll' will also work with pagination to load ajax.
If only show all, then hide and simulate 'infinite scroll', it will make the site load heavily if there are many products. 🙂
Yes I know but as per requirement in this post we have numeric value in title which we can use and it will not affect load time.
Hi, @JKSportsCards:
What you can do is edit the cards name from "1 The first card" to "001 the first Card", then the sort function will work properly.
Best wishes.
I'm running into the same issue. How did you eventually resolve it?
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025