Zid Docs
AppsThemes
Payments
AppsThemes
Payments
Help Center
Slack
  1. Building with Vitrin
  • Getting Started
    • Introduction
    • Theme Development
    • Vitrin Changelog
    • Creating and Managing Theme Presets
    • Legacy Theme Migration
      • Store Settings Mapping
      • Moving to Vitrin Using LLMs
      • Twig to Jinja
      • Breaking Changes
  • Key Concepts
    • Architecture
    • Templates
      • Overview
      • Overridable Templates
      • Legacy Templates
      • Template Replacements
      • Templates Library
        • home.jinja
        • product.jinja
        • cart.jinja
        • category.jinja
        • products.jinja
        • categories.jinja
        • page.jinja
        • blogs.jinja
        • blog.jinja
        • faqs.jinja
        • reviews.jinja
        • questions.jinja
        • shipping_payment.jinja
        • 404_not_found.jinja
    • Settings
      • Schema files
      • Input Settings
      • Media Settings
      • Form Controls Settings
      • Products Settings
      • Additional Settings
      • Conditional Visibility
      • Migrating twig settings schema
    • Localization
      • localization (jinja v. twig)
    • Theme Editor
      • Overview
  • Building with Vitrin
    • Jinja Basics
    • Vitrin's Jinja Extensions
  • Vitrin CLI
    • Introduction
    • CLI Commands
  • Tips & Tricks
    • Performance
  • JS Integration
    • Supporting both Vitrin and Legacy themes
    • Responses & Errors
    • Cart
    • Products
    • Categories
    • Store
    • Account
    • Blogs
    • Options
    • Events
  • Features
    • SDK Popups – Integration Guidelines
    • Custom Styles Guide
    • Gift Card as a Popup
    • Addresses as a Popup
    • Login as a Popup
    • Checkout as a Popup
    • Apple Pay Quick Checkout
    • Region & Language Popup
    • Dynamic Bundle Products
    • Progressive Discounts
    • Customer Wallet & Cashback
    • Add Preorder Support to Your Theme
  • Mobile Apps
    • Scripts
  • API's
    • Authentication
      • Logout
      • Login Status
      • SMS Login
      • Verify SMS Login
      • WhatsApp Login
      • Verify WhatsApp Login
      • Email Login
      • Verify Email Login
      • Register
      • Register Guest
    • Products
      • List Products
      • Search Products
      • Calculate Product Options Price
      • Notify Product Stock Availability
      • Fetch Bundle Offers
      • Fetch Bundle Offers for a Product
      • List My Product Reviews
      • List Product Reviews
      • Create Product Review
      • Update Product Review
      • Delete Product Review
      • List Product Questions
      • Create Product Question
      • Get Product by Slug
      • Get Selection Groups
    • Categories
      • List Categories
    • Checkout
      • Get Cart
      • Remove Cart
      • Duplicate Cart
      • Add Cart Item
      • Empty Cart
      • Update Cart Item
      • Remove Cart Item
      • Upload Cart Input Field
      • Add Gift Card
      • Remove Gift Card
      • Apply Coupon
      • Remove Coupon From Cart
      • Check Coupon Validity
      • Apply Loyalty Points
      • Remove Loyalty Points
      • Preview Rewarded Points
      • List Redemption Methods for Cart
      • Customer’s Loyalty Wallet
      • Customer’s Current Points Balance
    • Account
      • Get Profile
      • Delete Account
      • Update Customer Profile
      • Get Addresses
      • Create an Address
      • Get an Address by ID
      • Update an Existing Address
      • Delete Address
      • Get Orders
      • Get Shareable Wishlist Link
      • Get Wishlist
      • Add Products to Wishlist
      • Remove Product from Wishlist
      • Get Address Form Schema
      • Check Product Purchase Status
    • Storefront
      • Store Scripts
      • Pages
      • Blogs
    • Countries
      • Get Countries
      • Get Cities By Country
  1. Building with Vitrin

Jinja Basics

Zid themes are powered by the Jinja templating engine. Making it easy to embed dynamic data and logic into your theme design while keeping layouts flexible and reusable.

Check out the full Jinja Documentation to discover all available syntax, tags, filters, and features you can apply to build fully customizable and flexible layouts.

Understanding the Basics#

Jinja uses two main syntax forms:
1.
Output variables — {{ ... }}
Used to display the value of a variable in the template.
2.
Control statements — {{ ... }}
Used for logic, loops, and template structure.
📚 Reference: Jinja Template Basics

Common Jinja Tags#

TagPurpose
extendsInherit from a base template
includeInsert another template inside this one
forLoop over sequences
if/ elif / elseConditional logic
setAssign variables

Template Inheritance (extends and block)#

Use extends to base your template on another (usually a layout), and block to fill in or override sections.
In this example:
The template inherits the overall HTML structure from main.jinja.
The title and content blocks are overridden to provide page-specific content.
📚 Reference: Jinja Template Inheritance

Base Layout Example#

Child templates extend this file and override blocks as needed.

Including Templates (include)#

Use include to insert another template’s contents, similar to a “copy-paste” at render time.
📚 Reference: Jinja Include Statement

Conditional Logic (if, elif, else)#

📚 Reference: Jinja If Statement

Loops (for)#

📚 Reference: Jinja For Statement

Variable Assignment (set)#


Filters#

Filters modify values before rendering. Zid supports Jinja’s core filters, plus some platform-specific ones.
Examples:
📚 Reference: List of Built-in Jinja Filters

Functions#

Functions perform logic or transformations in templates. Jinja provides built-in functions, and Zid adds platform-specific ones (e.g., url_for, asset_url).
📚 Reference: Built-in Jinja Functions

Null safety#

Jinja templating engine can handle accessing chained null elements safely, however it has limitations
for example trying to iterate on a null element or trying to devide by zero will break the rendering
Jinja provides builtin tests to protect against these mistakes
so you can check if a variable is iterable by testing
📚 Refernce: Jinja's builtin tests
Modified at 2026-02-17 07:02:10
Previous
Overview
Next
Vitrin's Jinja Extensions
Built with