We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

How can I sort products by best sellers on my site's shop page?

How can I sort products by best sellers on my site's shop page?

Jhon16
Tourist
45 0 2

Hello everyone,

 

I would like to ask for help. I'm trying to organize the 'Products' (Shop) section of my site using filters.

Since this is not a collection but a default page and I can't change the filters, I can't set how the products are displayed. This problem only occurs on the 'Shop' page of my site. If I click on it and go to view the products, I notice that they are ordered alphabetically from A to Z.
However, I would like to show them directly based on "best sellers".

Here is the direct link to the Shop page of my site: https://a3cd78.myshopify.com/collections/all

Does anyone know how I can solve this problem?

Thank you

Replies 4 (4)

ThomKnepper
Shopify Partner
196 30 71

Hi there,

 

So there is a little bit of a trick here. All you have to do is create a new collection, name it however you like and ensure that all the products are loaded in. Then simply make the settings on how you would like them and update the "shop" navigation link to this collection you have just created.

 

Hope this helps!

Best wishes,
Thom Knepper - Athom.Agency
- Was my reply helpful? Please Like to let me know!
- Was your question answered? Awesome! Please Mark it as an Accepted Solution
Jhon16
Tourist
45 0 2

Hi, yes, but the problem is that when creating a collection I always have to manually import all the products

ThomKnepper
Shopify Partner
196 30 71

Hi there,

 

You actually don't, you can simply do it based on tag or another variable. Also, you can actually edit the "all products" collection to sort on best selling by default 😉

 

Best wishes,
Thom Knepper - Athom.Agency
- Was my reply helpful? Please Like to let me know!
- Was your question answered? Awesome! Please Mark it as an Accepted Solution

MRamzan
Shopify Partner
533 3 46

Here is the way to make 'Best Selling' filter as default:

 

 

Use below code:

 

<script>
  let shopifymode = Shopify.designMode;
  let maincollection = '{{ template.name }}';
  let currentUrl = window.location.href;
  
  if (maincollection === 'collection' && shopifymode === undefined) {
    if (!currentUrl.includes('sort_by=')) {
      
      // Create the new URL properly
      let newUrl;
      if (currentUrl.includes('?')) {
        // If URL already has query parameters, append with &
        newUrl = currentUrl + '&sort_by=best-selling';
      } else {
        // If no existing parameters, add with ?
        newUrl = currentUrl + '?sort_by=best-selling';
      }
      
      // Force page reload with the new URL
      window.location.replace(newUrl);
    }
  }
</script>
Hire Me:

WhatsApp: +91-9145985880
Email: mohdramzaan112@gmail.com
Skype: mohdramzaan112