Disable Sort By Best Selling In Shopify – Stop Competitors From Stealing

Eddy Chung

Disable “?sort_by=best-selling” is a great way to stop competitors from stealing your products from your Shopify store.

This is easy to do with a little bit a liquid code. Modify your collection.liquid file to this:

{% if collection.sort_by == 'best-selling' %}
{% else %}
  <!-- your original collection.liquid code in here -->
{% endif %}

Or if you prefer using JavaScript, you can insert this code in the <head> section of the theme.liquid file of a theme:

if(document.location.href.indexOf('https://YOUR-STORE-NAME.com/collections/all?sort_by=best-selling') > -1) { 
document.location.href = 'https://YOUR-STORE-NAME.com/collections/all';

Remember to change the store URL to your stores URL. You can feel free to modify the redirection URL to any URL in your store.