d
Topic
Posts:
1
December 08, 2016

Disable ?sort_by=best-selling Function

I do not want my competitors to be able to view my best selling products. I have seen this disabled on other stores and they get redirected to the homepage.. or another page.

How can I disable people from searching /collections/all?sort_by=best-selling

i
Replies
Chantal Shopify Employee
Posts:
49
December 09, 2016

Hey Peak Vibrations!

Chantal, Shopify Guru here to help!

I've had success with this by adding this code:

 <script>
if(document.location.href.indexOf('https://wearepeakvibrations.com/collections/all?sort_by=best-selling') > -1) { 
document.location.href = 'https://wearepeakvibrations.com/collections/all';
}
</script>

to the <head> section of the theme.liquid file of a theme. You can change the URL for document.location.href = 'URL' to whichever page you'd like for visitors to be redirected to when they try to visit the URL /collections/all?sort_by=best-selling on your site.

Hope this helps!

Chantal, Shopify Guru

Chantal, Shopify Guru
Posts:
2
10 months ago

There is a big red flag that says this post is outdated, but I can't find a "current" solution.  Will this still work?

 

Zac Harvey Member
Posts:
4
8 months ago

Works for me. Make sure you change the site URL.

Jason Shopify Expert freakdesign.com.au
Posts:
8802
8 months ago
g
1
upvotes

Here's a Liquid based approach if you want to avoid using JavaScript.
https://freakdesign.com.au/blogs/news/disable-sort-by-best-selling-on-shopify

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
Posts:
2
9 days ago

One other approach you could try is to just customize your all collection.  In theory most people will be looking at your ALL collection to see the overall best sellers in your shop.

Basically, you can make a custom version of your ALL collection and only put a subset of your products in there that you control.

I summarized the three approaches discussed in this thread over on my blog if you'd like to read more:
https://burstcommerce.com/how-to-hide-your-shopify-best-sellers-from-your-competitors/

Best Seller Insights: https://apps.shopify.com/best-sellers

Log in or sign up for an account to reply.

f
Your Reply