Skip to content
Log in

▶️ Use Liquid templates

On this page

Liquid templates sit between your store’s data and what a visitor sees. Each template holds the HTML for part of your storefront, plus the Liquid code that pulls in live data such as products, categories, and cart contents. Watch this video if you are customizing a theme for the first time and want to know which template to edit and how to get data into it.

For full theme template information, see Liquid theme components and Theme templates.

Code snippets referred to in the video

Low stock badge snippet

This is the body of the snippet template, saved as a Theme Template with the key snippets/low_stock_badge. It reads the product on the current page and shows a warning only when the product tracks inventory and has fewer than five units left to sell.

```liquid

{% if current_product.track_inventory? and current_product.total_available_to_sell < 5 and current_product.total_available_to_sell > 0 %}

⚠️ Only {{ current_product.total_available_to_sell }} left in stock!

{% endif %} ```

Render the snippet

Add this line to the product page template wherever you want the badge to appear. The name in quotes is the snippet’s key without the snippets/ prefix.

```liquid

{% render “low_stock_badge” %} ```

Was this article helpful?

Was this article helpful?