creative designer

Shopify allows you to dynamically adjust the order of a collection using the sort_by querystring in the url. Let's explore some simple code that makes it harder for a customer to use that sorting querystring to see your best sellers.

Example

Add the sort_by=best-selling to any collection on my experiments page and you'll see that the html returned is different. For the lazy, click this magical link or compare it to a url without the querystring.

The Code

grabbing the liquid snippet...

Let's end with a warning

This uses an unpublished liquid property on the collection called sort_by. You could have guess this very easily based on the fact there's also a default_sort_by. If sort_by is removed this idea dies with it.

This also won't 100% stop people from seeing your best sellers but it's a decent hurdle to add into the mix.

Like to work with me?

Let's talk