Prowadzimy rekrutację w Polsce do naszych biur w Krakowie i Tarnowie - dowiedz się więcej!

Shopify Liquid hints we use in our day-to-day work

It's a collection of different type Liquid shortcuts we discovered while solving specific practical issues on the stores of our Clients who use this platform.

Missing component: content/content/introheader

How to override default theme.liquid file

Put the following Liquid syntax as the first line in any of a template file (index.liquid, product.liquid, etc.):


In this instance, the default theme.liquid will be not be applied but rather the layout called alternative.liquid.

Output data without any layout being applied

When it's useful? For example you want to master some sort of internal pseudo-API that supposed to fetch data using Liquid (Shopify is having different limits promoting the Liquid for data fetching) and you want to output this gathered by Liquid data in a form of JSON to later consume somewhere else.

It's possible to request that the layout file isn't applied. The syntax to request that a layout file isn't applied is:

{% layout none %}

This needs to be the first line at the top of the relevant template (index.liquid, product.liquid, etc.). This way if you formatted output in Liquid as a JSON you will get a nice JSON.

Advanced submenus for collections, tied up links from navigation to specific collection handle

Detect using Liquid on which page or a Template you are

Useful when you want to display specific elements or UX on specific page or a template

For example If you want some code to be rendered on the homepage, you could use

or if you want to check which template is being used, use this code below

There is way how to request some more information using Shopify docs

https://shopify.dev/docs/api/liquid/objects/request

Image

Also some gems from this discussion about Liquid on Shopify Github

https://github.com/Shopify/liquid/issues/525

Shopify does know about some URLs that you might get some mileage from, depending what template you are on and what you are trying to do. All of the following will return URL-related value strings...

shop.url
shop.domain
page.url
collection.url
product.url
blog.url
article.url
article.comment_post_url

by: https://github.com/rickydazla

and

by: https://github.com/srinathperera101

Visit Our Office

16 Halcyon Ln
Aliso Viejo, CA 92656

Let's Talk

Phone: (415) 910-2498

call us
CUSTOMER SERVICE

We are happy to listen
suggest a feature, report a bug.

Submit Feature Request