Smart collection "Best selling" sort renders wrong order in Liquid

Short description of issue

Liquid renders Smart collections sorted by “Best selling” in a different order than the Shopify Admin and the Storefront API.

Reproduction steps

  1. Create a Smart collection with several products.
  2. Set Sort: Best selling on the collection in Admin.
  3. Note the product order shown in Admin.
  4. Open the collection in Theme Editor or in the store directly, both with default sorting.
  5. Compare the order rendered by Liquid against the Admin order and against the order returned by the Storefront API.

Expected: all three surfaces return products in the same order.
Actual: Liquid renders a different order than Admin / Storefront API.

Additional info

  • Reproduced on multiple stores and multiple themes, including the stock Dawn and Horizon themes, so it doesn’t look theme-specific.
  • Storefront API returns the same order as Admin, so the discrepancy is specifically on the Liquid side.

What type of topic is this

Bug report

Upload screenshot(s) of issue

Hey @Anton -

Thanks for the isolation work here.

If you’re open to sharing, a specific store + smart collection handle where you’re seeing this reproduce would help a lot, even just via DM if you’d rather not share publicly.

Also - is this happening on the main collection template (/collections/handle), or are you also seeing it in other spots where collection.products is iterated (related collections, recommendations, etc.)?

Hope to hear from you soon!

@Alan_G Sure, it’s reproducible on our dev store seven-minds-development-store.myshopify.com with the men collection.

It happens on the default collection template as well as anywhere else that uses collection.products in Liquid. We originally ran into it while working on our app, which renders collection.products inside an app block.

Hey @Anton - thanks for confirming, this helps narrow it down on our end. I’ll look into this internally and loop back once I have more info.