Tutorial

Shopify Liquid tutorial for beginners: your first real fix in 20 minutes

Learn Shopify Liquid by fixing a real bug: a product page that shows 1899 instead of $18.99. Objects, filters and tags, with the exact commands and code.

Bas Lefeber

Founder, learnshopify.dev

Published
Reading time
7 min read
Fix this bug in your browserAn 8-minute lesson with the same bug: a product page shows 1899 instead of $18.99. Fix it in real Liquid and watch the store update. Free, nothing to install.

Liquid is the template language Shopify themes are written in. You learn it fastest by fixing something real. Your first fix: a product page shows the price as 1899 instead of $18.99. The fix is one filter, {{ product.price | money }}, and by the end of this tutorial you will know why it works.

One small fix, done properly.

The short version

Liquid has three parts. Objects in {{ }} print store data, like {{ product.title }}. Filters after a | change that data, like | money. Tags in {% %} add logic, like {% if %}. Shopify gives prices in cents, so a price without the money filter prints as 1899.

What you need

You need basic HTML. You do not need JavaScript for this tutorial. You can follow it two ways: on your own free Shopify store with the Shopify CLI, or in the browser with lesson 1 on learnshopify.dev, which has the same bug ready to fix and checks your code. The browser route needs nothing installed.

Step 1: Get a store and a theme to work on

Never practise on a store that is selling. Make a free dev store instead. A dev store is a free Shopify store for building themes. Install the Shopify CLI first. It needs Node.js 22.12 or higher and Git 2.28 or higher.

bash
npm install -g @shopify/cli@latestshopify store create dev --demo-data

The --demo-data flag fills the store with test products, so you have something to look at. You can also create the store in the Dev Dashboard: Stores, Create store, then Dev. Then download the theme and start the local preview:

bash
mkdir my-theme && cd my-themeshopify theme pull --store your-storeshopify theme dev --store your-store

theme pull asks which theme to download. Pick the live one. theme dev uploads your copy as a development theme and prints a local URL, usually http://127.0.0.1:9292. Open it in Google Chrome (the preview only works there). Every time you save a file, the page updates. Shopify's create a theme guide covers this step in more detail.

No terminal? Use the code editor

In the Shopify admin, go to Online Store, Themes, click ... on a theme, then Edit code. Duplicate the theme first and edit the copy, so the live store is never touched. The code editor docs show where everything is.

Step 2: Learn the three parts of Liquid

A Liquid file is HTML with three extra kinds of code inside it. Shopify runs the Liquid on its servers and sends plain HTML to the shopper's browser.

PartLooks likeWhat it does
Object{{ product.title }}Prints a value from the store. On a product page this prints the product's name.
Filter{{ product.price | money }}Changes the value before it prints. Filters go after a pipe, and you can chain several.
Tag{% if product.available %}Adds logic: conditions, loops and variables. Tags print nothing on their own.

Which objects exist depends on the page. On a product page you get product. On a collection page you get collection. Some objects, like shop and cart, work on every page. The Liquid reference lists all of them, and it is the page you will open most as a Shopify developer.

Learn this properly · free lesson

Meet Liquid: write your first line

Write your first line of Liquid and watch a real storefront change as you type. Free, in your browser.

Try this lesson for free

Step 3: Find the bug

Here is the bug for this tutorial. Create a new file in your theme's sections folder called first-fix.liquid and paste this in. It has the two mistakes a beginner (or an AI tool in a hurry) makes on a product page.

sections/first-fix.liquid
<div class="first-fix">  <h2>Ethiopian Yirgacheffe</h2>  <p class="first-fix__price">{{ product.price }}</p></div> {% schema %}{  "name": "First fix",  "enabled_on": { "templates": ["product"] },  "presets": [{ "name": "First fix" }]}{% endschema %}

The part between {% schema %} and {% endschema %} tells the theme editor about the section. enabled_on limits it to product pages, and presets lets you add it from the editor (section schema docs). Open the theme editor link that theme dev printed, go to a product page, click Add section and pick First fix.

Now look at the page. You will see two problems:

  1. Every product has the same name. The title is typed into the HTML, so it says Ethiopian Yirgacheffe on every product in the store.
  2. The price is a strange number. A product that costs $18.99 shows 1899.

Step 4: Fix it

Replace the typed name with the product's title, and send the price through the money filter:

sections/first-fix.liquid
<div class="first-fix">  <h2>{{ product.title }}</h2>  <p class="first-fix__price">{{ product.price | money }}</p></div> {% schema %}{  "name": "First fix",  "enabled_on": { "templates": ["product"] },  "presets": [{ "name": "First fix" }]}{% endschema %}

Save the file. The preview updates, and each product now shows its own name and a price like $18.99. You changed two lines, and the section now works for every product in the store.

Why the price was 1899

Shopify stores prices as whole numbers in the smallest unit of the currency: cents for dollars and euros, paise for rupees. product.price for an $18.99 coffee is 1899. Whole numbers avoid rounding errors when Shopify adds up a cart. For currencies with no smaller unit, like the Japanese yen, Shopify still adds two digits, so 1000 yen comes out as 100000 (product object docs).

The money filter turns that number into a price using the store's own money format, so the same code prints $18.99 in a US store and €18,99 in a store set up for euros with a comma. That is why you never type a currency symbol into a theme. More on that in how to format money in Shopify Liquid.

Step 5: Add one more win, a sale price

Most products come in sizes or colours. Each one is a variant with its own price. On a product page, the price should follow the variant the shopper picked. Shopify's Horizon theme does exactly this in its snippets/price.liquid file. Update your section like this:

sections/first-fix.liquid
{% assign variant = product.selected_or_first_available_variant %} <div class="first-fix">  <h2>{{ product.title }}</h2>  <p class="first-fix__price">{{ variant.price | money }}</p>  {% if variant.compare_at_price > variant.price %}    <p class="first-fix__was">Was <s>{{ variant.compare_at_price | money }}</s></p>  {% endif %}</div>

Three new things here. {% assign %} saves a value in a variable. selected_or_first_available_variant is the variant in the URL, or the first one in stock. And {% if %} shows the old price only when the variant is on sale. Keep the schema at the bottom of the file the same. In your dev store, give a product a compare-at price higher than its price to see the line appear.

Step 6: Check your code

Shopify has a built-in linter for themes called Theme Check. Run it from the theme folder:

bash
shopify theme check

It reports Liquid errors, unknown filters and objects, and performance problems. Run it before you hand any work to a client.

Mistakes AI tools make here

If you ask an AI tool for this section, check its answer for these three things. They come up again and again in code reviews:

  • A filter that does not exist. Filters like titleize come from other languages, like Ruby on Rails. They are not in Shopify's Liquid, so they do not work in a theme, and Theme Check reports them as unknown filters. If a filter is not in the Liquid reference, do not use it.
  • A hardcoded currency. Code like ${{ product.price | divided_by: 100 }} looks right in a US store and is wrong everywhere else.
  • The product price on a product page. product.price is the lowest variant price. When a shopper picks a bigger size, the price on the page should change with it.

Learn this properly · free lesson

Output expressions: writing data into a page

Output and filters properly: chain filters, read the reference, and print store data the way production themes do.

Try this lesson for free

What to learn next

You now know objects, filters, a variable and an if tag. The next things to learn, in order: loops ({% for %}) to list products in a collection, the main objects (product, variant, collection, cart, customer), and then how a theme is built from sections and blocks. The Shopify developer roadmap puts all of it in order.

On learnshopify.dev, Module 1 teaches all of this in 20 short lessons on a practice coffee store, and every task is checked as you go. Start Module 1 for free, no card needed.

Frequently asked questions

What is Liquid in Shopify?

Liquid is the template language Shopify themes are written in. It mixes into HTML: objects in {{ }} print store data such as a product title, filters after a | change that data, and tags in {% %} add logic such as conditions and loops. Shopify runs the Liquid on its servers and sends plain HTML to the browser.

Is Shopify Liquid hard to learn?

No, if you know basic HTML. The syntax is small: objects, filters and tags. Most people write a useful first fix within an hour. The harder part is learning the Shopify objects (product, variant, collection, cart) and how a theme is built from sections and blocks.

Why does my Shopify price show as 1899 instead of $18.99?

Shopify gives prices in the currency's smallest unit, so $18.99 is 1899 cents. Pipe the price through the money filter: {{ product.price | money }}. It formats the number with the store's own money format and currency symbol.

Do I need to know JavaScript to learn Liquid?

Not to start. Liquid runs on Shopify's servers and only needs HTML around it. You will want JavaScript later for things that change without a page reload, such as a cart drawer.

Where can I practise Shopify Liquid for free?

On a free Shopify dev store with the Shopify CLI (shopify store create dev, then shopify theme dev), or in the browser on learnshopify.dev, where Module 1 is free and every task is checked.

  • Liquid
  • Learning Shopify
  • Beginner
  • Shopify themes

About the author

Bas Lefeber, Founder, learnshopify.dev

Bas builds learnshopify.dev, where developers learn production-grade Shopify theme development against a live storefront. He writes about Liquid, theme architecture, and the parts of the job that still matter now that AI writes the code.

Keep going in the curriculum

Start free

Ready to become a Shopify developer?

You just read how it works. Now write it yourself: real tickets from a live store, in an editor where the storefront updates as you type. Module 1 is free, no card.

Start your first lesson

Free · No credit card · Your first win in minutes