A Shopify store using the Horizon theme has color variant buttons appearing in random order after products are imported from eBay through the Reputon app. Manual reordering is impractical because there are many products, so the goal is to sort color options alphabetically on product pages.
A workaround was provided using a Custom Liquid block in the product page template. The supplied JavaScript detects variant picker fieldsets whose option name includes “color,” “colour,” or “couleur,” then reorders only those buttons A–Z on the storefront. It leaves other options such as size unchanged and uses a MutationObserver so the order stays sorted if Horizon re-renders the variant picker after customer interactions.
The solution is display-only: it does not alter Shopify admin data or actual variant ordering. The store owner agreed to test the snippet and mark it as solved if it works. Another response notes Shopify does not natively support automatic alphabetical sorting of variant values, so a theme customization, script, or app is likely required.
I sell hosiery on my Shopify store using the Horizon theme. I import products from eBay via the Reputon app.
After each import, the color variant options appear in a random order on the product page. I cannot reorder them manually because there are too many products.
Is there a way to automatically sort variant options alphabetically on Horizon? Either natively or via a simple workaround?
Change display is good enough for the customers, share you snippet and I will try it. If it’s work fine, I will check solution of course.
Thank you, Hervé
The list at the top (color, colour, couleur) is what it checks against your option name, so your Couleur dominante is already covered. If a product names the colour option something else, add that word to the list.
It only touches options whose name matches, so Taille and every other option keep the order you set.
It re-applies when a shopper switches a size, so the order never jumps back.
Display only. Nothing in your admin or your variant data changes.
Shopify doesn’t currently support automatic alphabetical sorting of variant values. If the import app can’t preserve the order, you’ll likely need a custom theme modification or an app/script to sort the option on a storefront