News
Updates, tips and notes on design and code
Looking for Shopify Code Snippets? See my GitHub Repo
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.
The fun thing about the undocumented sort_by property on collections is that you can pass whatever string to it that you like, and then be able to use it in Liquid. It's a pretty gross hack, but it might come in handy one day.
The need to schedule content changes in Shopify is something that apps are great at since the API gives many options for changes in content, and theme. Now if you're feeling a little DIY and want to build in something without an app there is way - let's explore it.
Generally a hidden collection won't be accessible in Liquid, but it is when referenced via a menu (linklist). It's important that your code can handle this possibility and skips the hidden collection in your loop - let's look at the simple code to do it.
Shopify Liquid has allows you to change the formatting of the date string but the default output is English. If you want to change the days or months to be shown in another language you'll need to translate it.
Talking to merchants around the world lets you learn about the many unique ways they need to run their stores . On example of this is a recent email I had from a merchant in the Netherlands that wanted to show BTW instead of VAT in notification emails.
There was a recent post on the Shopify eCommerce forums where someone asked how to change the sort order of products in the Admin (not the storefront). I can actually see the use case for this but thankfully a simple url change can make it happen.
Persistent cart is an interesting concept: On one hand I like the idea of a session that expires with the device I am using. On the other I see why merchants may want a cart that acts more like a saved wishlist.
Getting a shipping estimate for a single product on Shopify is tough since you need to first add it to the cart. With some JavaScript - and a little bit of cart cookie modification - we can add this feature in to any Shopify store without much fuss.