Skip to main content
Every Twig template has access to global variables and page-specific variables.

Global variables

These variables are available in all templates.

store

Store information and settings.
store.id
int
Unique store identifier
store.name
string
Store name
store.username
string
Store username/slug
store.description
string
Store description (may contain HTML)
store.slogan
string
Store slogan (if enabled in twilight.json)
Store logo URL
store.url
string
Store homepage URL
store.api
string
API URL for the current store
store.icon
string
Favicon URL

Store contacts

{{ store.contacts.email }}
{{ store.contacts.mobile }}
{{ store.contacts.phone }}
{{ store.contacts.whatsapp }}
{{ store.contacts.telegram }}

Store social

{{ store.social.instagram }}
{{ store.social.snapchat }}
{{ store.social.twitter }}
{{ store.social.youtube }}
{{ store.social.facebook }}
{{ store.social.pinterest }}
{{ store.social.maroof }}
{{ store.social.whatsapp }}

Store settings

store.settings.auth.email_allowed
bool
Email login enabled
store.settings.auth.mobile_allowed
bool
Mobile login enabled
store.settings.auth.is_email_required
bool
Email required for registration
store.settings.cart.apply_coupon_enabled
bool
Visitors can apply coupons in cart
store.settings.product.total_sold_enabled
bool
Show total sold count
store.settings.product.fit_type
string
Product image fit: cover, contain, or null
store.settings.tax.number
string
Tax/VAT registration number
store.settings.tax.certificate
string
Tax certificate image URL
store.settings.tax.taxable_prices_enabled
bool
Tax included in prices
store.settings.rating_enabled
bool
Ratings enabled (store, shipping, or products)
store.settings.is_multilingual
bool
Multiple languages enabled
store.settings.currencies_enabled
bool
Multiple currencies enabled

theme

Theme configuration and settings.
theme.id
int
Theme identifier
theme.name
string
Theme name
theme.mode
string
live or preview
theme.is_rtl
bool
Right-to-left language direction
theme.translations_hash
int
Cache-busting hash for translations

Theme colors

{{ theme.color.primary }}
{# Primary brand color #}

{{ theme.color.text }}
{# Text color (#000000 or #FFFFFF based on primary) #}

{{ theme.color.reverse_primary }}
{# Reverse of primary color #}

{{ theme.color.reverse_text }}
{# Reverse of text color #}

{{ theme.color.is_dark }}
{# Boolean: is primary color dark? #}

Theme color functions

{{ theme.color.darker(0.15) }}
{# 15% darker than primary #}

{{ theme.color.darker(0.25, '#ff6767') }}
{# 25% darker than specified color #}

Theme font

theme.font.name
string
Font name: DINNextLTArabic-Regular, Amazon-Ember, Apple, Dubai, Estedad
theme.font.path
string
CSS font file URL

Theme settings

{{ theme.settings.get('header_is_sticky', 'Default Value') }}
{{ theme.settings.get('enable_add_product_toast', true) }}
{{ theme.settings.get('footer_is_dark') }}
{{ theme.settings.get('topnav_is_dark') }}
{{ theme.settings.get('sticky_add_to_cart') }}

user

Current user information.
user.type
string
user or guest
user.language.code
string
Language code (e.g., en, ar)
user.language.name
string
Language name
user.language.dir
string
Text direction: ltr or rtl
user.can_access_wallet
bool
User can access wallet features
user.loyalty_points
int
Current loyalty points balance

currency

currency.symbol
string
Currency symbol (e.g., SAR, $, ر.س)

cart

Cart summary (available in header/footer).
cart.items_count
int
Number of items in cart
cart.total
string
Formatted cart total (e.g., "100 SAR")

page

Current page metadata.
page.title
string
Page title (may contain HTML)
page.slug
string
Page slug (e.g., "cart", "product.single")

Product variables

Available in product pages and product cards.
product.id
int
Product identifier
product.name
string
Product name
product.description
string
Product description (HTML)
product.url
string
Product page URL
product.promotion_title
string
Promotion badge text
product.subtitle
string
Product subtitle
product.type
string
product, service, group_products, codes, digital, food, donating
product.status
string
sale, out, out-and-notify

Product pricing

product.price
float
Current price (may be - string if merchant hides zero prices)
product.sale_price
float
Discounted price
product.regular_price
float
Original price before discount
product.starting_price
float
Starting price for products with options
product.currency
string
Product currency code
product.base_currency_price
float
Price in base currency (SAR)
product.discount_percentage
string
Discount percentage (e.g., "20%")

Product inventory

product.quantity
int
Available quantity (null if unlimited)
product.sold_quantity
int
Number of units sold
product.max_quantity
int
Maximum quantity per order
product.sku
string
Product SKU
product.weight
string
Product weight

Product media

{{ product.image.url }}
{{ product.image.alt }}

Product category

{% if product.category %}
  <a href="{{ product.category.url }}">
    {{ product.category.name }}
  </a>
{% endif %}

Product brand

{% if product.brand.name %}
  <a href="{{ product.brand.url }}">
    <img src="{{ product.brand.logo }}" alt="{{ product.brand.name }}">
  </a>
{% endif %}

Product tags

{% for tag in product.tags %}
  <a href="{{ tag.url }}">
    {{ tag.name }}
  </a>
{% endfor %}

Product rating

{% if product.rating %}
  <salla-rating-stars
    value="{{ product.rating.stars }}"
    reviews="{{ product.rating.count }}">
  </salla-rating-stars>
{% endif %}

Product booleans

product.is_on_sale
bool
Product has discounted price
product.is_available
bool
Product is available for purchase
product.is_out_of_stock
bool
Product is out of stock
product.is_in_wishlist
bool
User has added to wishlist
product.is_taxable
bool
Tax is included in the price
product.is_require_shipping
bool
Product requires shipping
product.is_hidden_quantity
bool
Quantity hidden by merchant or unavailable
product.has_options
bool
Product has options (size, color, etc.)
product.has_read_more
bool
Description is long and should be truncated
product.has_3d_image
bool
Product has 3D model
product.has_size_guide
bool
Product has size guide
product.is_giftable
bool
Product can be sent as gift

Cart variables

Available on cart page.
cart.id
string
Unique cart identifier
cart.is_require_shipping
bool
Any item requires shipping
cart.has_shipping
bool
Shipping company selected
cart.sub_total
float
Sum of items without shipping
cart.total
float
Final total including all costs
cart.discount
float
Total discount amount
cart.coupon
string
Applied coupon code
cart.tax_amount
float
Calculated tax amount
cart.real_shipping_cost
float
Actual shipping cost (may be free via offer/coupon)

Cart items

{% for item in cart.items %}
  <div class="cart-item" id="item-{{ item.id }}">
    <img src="{{ item.product_image }}" alt="{{ item.product_name }}">
    <h3>{{ item.product_name }}</h3>
    <p>{{ item.price|money }}</p>
    <p>Quantity: {{ item.quantity }}</p>
    <p>Total: {{ item.total|money }}</p>
  </div>
{% endfor %}
item.id
int
Cart item identifier
item.product_id
int
Product identifier
item.product_name
string
Product name
item.product_image
string
Product image URL
item.url
string
Product page URL
item.quantity
int
Item quantity
item.price
MoneyTaxable
Unit price
item.total
Money
Line total (price × quantity)
item.is_available
bool
Item is still available
item.has_discount
bool
Item has active discount

Free shipping bar

{% if cart.free_shipping_bar %}
  <div class="free-shipping-progress">
    {% set is_free = cart.free_shipping_bar.has_free_shipping %}
    
    {% if is_free %}
      <p>{{ trans('pages.cart.has_free_shipping') }}</p>
    {% else %}
      <p>{{ trans('pages.cart.free_shipping_alert', {
        'amount': cart.free_shipping_bar.remaining|money
      }) }}</p>
      
      <div class="progress-bar" style="width: {{ cart.free_shipping_bar.percent }}%"></div>
    {% endif %}
  </div>
{% endif %}
cart.free_shipping_bar.minimum_amount
float
Minimum cart total for free shipping
cart.free_shipping_bar.has_free_shipping
bool
Free shipping threshold reached
cart.free_shipping_bar.percent
float
Progress percentage (0-100)
cart.free_shipping_bar.remaining
float
Amount remaining to reach free shipping

Helper functions

Generates store URLs.
<a href="{{ link('/') }}">Home</a>
<a href="{{ link('/cart') }}">Cart</a>

is_page

Checks current page.
{% if is_page('index') %}
  <h1>{{ store.name }}</h1>
{% else %}
  <h2>{{ store.name }}</h2>
{% endif %}

trans

Translates text.
{{ trans('pages.cart.empty_cart') }}
{{ trans('common.elements.back_home') }}

Build docs developers (and LLMs) love