How to hide your Shopify best sellers from your competitors
As you may recall, a few months back I discussed how you can find the best selling products on any Shopify store.
Finding the best sellers on other people's Shopify store may sound great for doing competitive research.
But what if you don't want your competitors to be able to view your best selling Shopify products?
Is there anything you can do to stop your competitors from seeing your Shopify best sellers?
In today's post, I'll show you a few options you can use to hide your Shopify best sellers on your store.
We'll discuss:
- Hiding your Shopify best sellers using Javascript
- Hiding your Shopify best sellers using (undocumented) Liquid
- Customizing your Shopify
all
collection to hide your best sellers
Hiding your Shopify best sellers using Javascript
The first option you can try involves using Javascript to detect if a user is sorting your collection by best-selling
and then redirecting them
This approach was recommended by a Shopify employee in the Shopify forums.
You can see an example of this here:
var url = 'https://YOURSTORE/collections/all?sort_by=best-selling';
if ( document.location.href.indexOf(url) > -1) {
document.location.href = 'https://YOURSTORE/collections/all';
}
On line 2, the script is checking if the current url matches the /collections/all?sort_by=best-selling
for this store.
If it does, line 3 will then redirect the user to a non sorted view of the ALL collection.
You can apply this to any collection, but the the example shown above will only work on the Shopify all
collection.
This approach has a pro of being pretty quick to setup. You just have be somewhat comfortable editing your theme's code.
However, this approach has a fatal flaw:
Javascript can easily be disabled in the web browser.
So if a person disables Javascript, they will still see all of your best sellers.
If you decide to go this route, be sure to change YOURSTORE
in the code to your Shopify store url.
Hiding your Shopify best sellers using (undocumented) Liquid
The next approach you can try is courtesy of Jason of Freak Design.
This approach uses an undocumented Shopify Liquid property called collection.sort_by
.
The collection.sort_by
let's you know the current sort option a Shopify collection is sorted by.
Here is an example of this approach in action:
{% if collection.sort_by == 'best-selling' %}
<!-- your alternative best-selling sort liquid code goes here ->
{% else %}
<!-- your original collection.liquid code in here -->
{% endif %}
As you can see, line 1 checks to see if the collection is sorted by best-selling
.
Once you know the collection is sorted by best-selling
, you can then show some alternative Liquid code as shown on line 2.
This gives you the chance to build your very own custom "best sellers" list which can be anything you like.
One potential downside for this solution is since the collection.sort_by
is undocumented Shopify may remove it in the future.
Customizing your Shopify all
collection to hide your best sellers
The final approach I'd like to discuss for hiding your Shopify best sellers from your competitors involves customizing your Shopify all
collection.
The Shopify all
collection is a feature baked into Shopify and shows all products in your shop in a single collection.
Since the Shopify all
collection contains all products, it is usually the first place people will try when looking for your overall best sellers.
So what can you do to prevent your competitors from seeing your overall best sellers?
The solution is to create a custom version of your Shopify all
collection.
This custom all
collection is just like any other Shopify collection. That means you can put whatever you like into it.
This means you can control exactly what products others see when viewing your Shopify all
collection.
If you'd like to read more about this, I wrote up some instructions on how to customize your Shopify all
collection over here.
Summary
That wraps up this post on how to prevent your competitors from seeing your Shopify best sellers.
To recap, we discussed three ways you can hide your Shopify best sellers:
- You can use Javascript to prevent sorting collections by
best-selling
- You can use the undocumented
collection.sort_by
in Liquid to show something custom for thebest-selling
sort. - You can customize your Shopify
all
collection to only show hand-picked products.
While these techniques won't necessarily stop a determined competitor from figuring out what sells well in your store, they should at least not make it easy for them.