This week I’ve published a short post on learning Shopify Liquid. This templating language is used to make customisation of the Shopify experience easy for developers.
As I recently went through the Shopify Plus Partners certification process I decided to get under the skin of Liquid and make some mods to my Shopify Plus sandbox store.
I like to share stuff, and I’ve created a real quick list of useful code to get you started, some of which I used in my sandbox to improve user experience and functionality.
Below is my quick guide to getting started with Shopify Liquid.
Know which template is rendering a page
p style=“background: #f1c40f; padding: 1em; font-weight: bold;”>Current template: {{ template }}.liquid
For each example
Liquid logic example
Price: £99.99
Sorry - Sold Out
Delimiters explained
Escaping whitespace - use %- -%
Adding a stylesheet - first at to assets library
Will render the actual asset URL automatically, works for various assets.
Create and select alternate templates
Modify template view using URL’s
Loads: product.special.liquid
Specify image sizes
Above only works if an image is square…
Or width only (RIP)
Or height only (RIP)
To make non square images square use the crop function
Image formatting for progressive loading
Placing imagery from assets folder
Append classes to images (From assets)
Remove img-tag to add class ID’s
You can also link the the Liquid Cheat Sheet here or download the official learning liquid manual here. Hopefully you find the above useful as well as the resource link and guide. If you have a Shopify project you are working on and get stuck, give us a shout to see if we can help.