Liquid basics
Liquid is Shopify's templating language. It uses two types of markup:
{{ object.property }}— outputs a value{% tag %}— performs logic (if, for, assign)
Displaying a product metafield
If you've added a metafield called custom.care_instructions to your products:
{% if product.metafields.custom.care_instructions %}
<div class="care-instructions">
<h4>Care Instructions</h4>
<p>{{ product.metafields.custom.care_instructions.value }}</p>
</div>
{% endif %}Conditional logic by product type
{% if product.type == "Electronics" %}
<p class="warranty-badge">2-Year Warranty Included</p>
{% elsif product.type == "Clothing" %}
<p class="size-note">Model is 5'10" wearing size M</p>
{% endif %}Looping over variants
{% for variant in product.variants %}
<div class="variant-option {% if variant.available == false %}sold-out{% endif %}">
{{ variant.title }} — {{ variant.price | money }}
</div>
{% endfor %}Filtering with Liquid filters
{{ product.price | money }} {%- comment -%} Rs 1,500.00 {%- endcomment -%}
{{ product.description | truncate: 150 }}
{{ product.title | upcase }}
{{ product.created_at | date: "%B %d, %Y" }}Where to edit
In the Shopify admin: Online Store → Themes → Actions → Edit code → Templates → product.json (for OS 2.0 themes) or product.liquid for older themes.
Always duplicate your theme before editing.