1. Hooks
Salla Platform Docs
  • Theme Architecture
    • Layouts
      • Overview
      • Global Variables
      • CSS Variables
      • Custom Fonts
      • Master Layout
      • Salla Icons
      • Hooks
      • Localizations
      • Salla Component Hooks
      • Hooks
        • Overview
        • Template Hooks
        • Component Hooks
    • Pages
      • Home Page
      • Overview
      • Product Pages
        • Products listing
        • Single product
      • Customer Pages
        • Profile
        • Orders list
        • Order details
        • Wishlist
        • Notifications
      • Blog Pages
        • Blog listing
        • Single blog
      • Brand Pages
        • Brands listing
        • Single brand
      • Common Pages
        • Cart
        • Loyalty
        • Thank you
        • Single page
        • Landing Page
    • Components
      • Overview
      • Home Components
        • Youtube
        • Fixed banner
        • Testimonials
        • Parallax background
        • Photos slider
        • Store features
        • Square photos
        • Fixed products
        • Products slider
        • Featured products - Style 1
        • Featured Products - Style 2
        • Featured Products - Style 3
        • Brands
        • Enhanced Square Banners
        • Main Links
        • Enhanced Slider
        • Slider Products with Headers
        • Latest Products
        • Vertical Menu with Slider
      • Product Components
        • Essentials
        • Options
      • Common Components
        • Header Components
        • Footer Components
        • Comments component
  • Requirements & Review
    • Overview
    • Main Requirements
    • Review Process
      • UI / UX Review
      • Technical Review
      • Metadata Review
      • Pre-Launch Review
  • Getting Started
    • Create a theme
    • Setup a theme
    • Develop a theme
    • Publish a theme
  • Files and Folders Structure
    • Directory structure
    • Twilight.json
  • Twig Template Engine
    • Basic syntax
    • Twilight flavoured twig
  • Change Log
Merchant
Merchant
  • Merchant API
  • Embedded SDK
  • Salla OAuth 2.0
Storefront
Storefront
  • Twilight Engine
  • Twilight SDK
  • Web Components
  • Ecommerce Events
  • Component Bundle
  • Checkout APIs
  • Change Log
App Functions
Partner APIs
Partner APIs
  • App API
  • Shipments & Fulfillment APIs
  • Salla AWB
  • Recurring Payments API
  • Billing System Salla partners
  • Communication Apps
Dev Tools
Dev Tools
  • Partners Agent Kit
  • Salla Apps Playbook
  • Salla CLI
Merchant
Merchant
  • Merchant API
  • Embedded SDK
  • Salla OAuth 2.0
Storefront
Storefront
  • Twilight Engine
  • Twilight SDK
  • Web Components
  • Ecommerce Events
  • Component Bundle
  • Checkout APIs
  • Change Log
App Functions
Partner APIs
Partner APIs
  • App API
  • Shipments & Fulfillment APIs
  • Salla AWB
  • Recurring Payments API
  • Billing System Salla partners
  • Communication Apps
Dev Tools
Dev Tools
  • Partners Agent Kit
  • Salla Apps Playbook
  • Salla CLI
Salla - Opensource
Salla - Developers Community
  1. Hooks

Template Hooks

Template Hooks are predefined slots built into Salla's Twilight theme templates. They allow theme developers to inject custom HTML, scripts, or components into specific areas of any page — cleanly and safely — without modifying the core theme files.
Template Hooks use Twig syntax. If you are looking to interact with Salla components via JavaScript instead, see the Component Hooks article.

📙 What You'll Learn#

How Template Hooks Work
Head Hooks
Body Hooks
Product Page Hooks
Cart Page Hooks
Thank You Page Hooks
Brand Page Hooks
Blog Page Hooks
Customer Page Hooks
Component Hooks

How Template Hooks Work#

A template hook is a Twig tag you place inside a .twig template file at the exact point where you want custom content to appear. When the page renders, Salla's hooks system mounts any content registered to that slot.
Twilight theme comes with a predefined list of hooks already placed in all default templates. You do not need to add them yourself — they are already there waiting to be used.
The hooks system behind the scenes is the same Hooks class that powers Component Hooks. When a Twig template calls {% hook 'head:start' %}, it triggers the mount() method internally, injecting any registered content into that slot at render time.

Head Hooks#

The <head> element contains information about the webpage that is not displayed directly — meta tags, SEO data, stylesheets, and scripts. Head hooks give you a clean way to inject content into this section without touching the core layout file.
#HookDescription
1{% hook 'head:start' %}Fires at the very start of the <head> section
2{% hook head %}Fires inside the <head> section
3{% hook 'head:end' %}Fires at the very end of the <head> section
Common uses: Adding custom meta tags, injecting third-party analytics scripts, adding canonical URLs, inserting custom stylesheets.

Body Hooks#

Body hooks let you inject content at the very start or end of the <body> tag, or add CSS classes to it for page-specific styling.
#HookDescription
1{% hook 'body:classes' %}Adds CSS classes to the <body> tag
2{% hook 'body:start' %}Fires at the very start of the <body> section
3{% hook 'body:end' %}Fires at the very end of the <body> section
Common uses: Adding page-specific CSS classes for styling overrides, injecting chat widgets or global scripts that need to wrap the full page.
Example: Adding a page-specific class via body:classes

Product Page Hooks#

Twilight provides hooks for both the product listing page and the single product page, giving you control over content placement around product descriptions, forms, and item lists.
#HookDescription
1{% hook 'product:index.items.start' %}Fires at the start of the product listing items
2{% hook 'product:index.items.end' %}Fires at the end of the product listing items
3{% hook 'product:single.description.start' %}Fires before the product description on a single product page
4{% hook 'product:single.description' %}Fires inside the product description area
5{% hook 'product:single.description.end' %}Fires after the product description on a single product page
6{% hook 'product:single.form.start' %}Fires before the add-to-cart form on a single product page
7{% hook 'product:single.form.end' %}Fires after the add-to-cart form on a single product page

Cart Page Hooks#

Use these hooks to inject custom content into the cart page, either around the items list or around the cart summary and submit areas.
#HookDescription
1{% hook 'cart:items.start' %}Fires at the start of the cart items list
2{% hook 'cart:items.end' %}Fires at the end of the cart items list
3{% hook 'cart:summary.start' %}Fires at the start of the cart summary section
4{% hook 'cart:summary.end' %}Fires at the end of the cart summary section
5{% hook 'cart:submit.start' %}Fires before the cart submit button
6{% hook 'cart:submit.end' %}Fires after the cart submit button

Thank You Page Hooks#

The thank you page hooks let you inject content before and after the order confirmation content — useful for upsells, tracking pixels, or custom messaging.
#HookDescription
1{% hook 'thank-you:start' %}Fires at the very start of the thank you page
2{% hook 'thank-you:items.start' %}Fires before the order items list
3{% hook 'thank-you:items.end' %}Fires after the order items list
4{% hook 'thank-you:end' %}Fires at the very end of the thank you page
The thank-you:end hook also injects two buttons — Go Back to the Store and Create Salla Store — but only for stores on the Basic plan.

Brand Page Hooks#

These hooks let you customize both the brand listing page and individual brand detail pages.
#HookDescription
1{% hook 'brands:index.items.start' %}Fires at the start of the brand listing items
2{% hook 'brands:index.items.end' %}Fires at the end of the brand listing items
3{% hook 'brands:single.details.start' %}Fires before the single brand details section
4{% hook 'brands:single.details.end' %}Fires after the single brand details section
5{% hook 'brands:single.items.start' %}Fires before the product items on a single brand page
6{% hook 'brands:single.items.end' %}Fires after the product items on a single brand page

Blog Page Hooks#

Twilight provides hooks for both the blog listing page and individual blog post pages.
#HookDescription
1{% hook 'blog:index.items.start' %}Fires at the start of the blog listing items
2{% hook 'blog:index.items.end' %}Fires at the end of the blog listing items
3{% hook 'blog:single.items.start' %}Fires at the start of a single blog post
4{% hook 'blog:single.items.end' %}Fires at the end of a single blog post

Customer Page Hooks#

These hooks let you extend and customize customer-facing pages such as the profile, orders, wishlist, and notifications.
#HookDescription
1{% hook 'customer:profile.form.start' %}Fires at the start of the customer profile form
2{% hook 'customer:profile.form.fields.start' %}Fires before the profile form fields
3{% hook 'customer:profile.form.fields.end' %}Fires after the profile form fields
4{% hook 'customer:profile.form.submit.start' %}Fires before the profile form submit button
5{% hook 'customer:profile.form.submit.end' %}Fires after the profile form submit button
6{% hook 'customer:profile.form.end' %}Fires at the end of the customer profile form
7{% hook 'customer:notifications.items.start' %}Fires at the start of the customer notifications list
8{% hook 'customer:notifications.items.end' %}Fires at the end of the customer notifications list
9{% hook 'customer:wishlist.items.start' %}Fires at the start of the customer wishlist items
10{% hook 'customer:wishlist.items.end' %}Fires at the end of the customer wishlist items
11{% hook 'customer:orders.index.items.start' %}Fires at the start of the customer orders list
12{% hook 'customer:orders.index.items.end' %}Fires at the end of the customer orders list
13{% hook 'customer:orders.single.details.start' %}Fires before the single order details
14{% hook 'customer:orders.single.details.end' %}Fires after the single order details

Component Hooks#

By default, Twilight automatically adds two hooks around any component rendered in a template — one at the start of the component and one at the end. You can use these to inject content before or after any component without modifying it.
The pattern is always:
component:{component.path}.start
component:{component.path}.end
These component-level template hooks are different from the JavaScript Component Hooks API. These are server-side Twig slots; the JS API is for client-side runtime interaction. See Component Hooks for more.

Dynamic Page Hooks#

In addition to the predefined hooks above, Twilight also registers hooks dynamically based on the current page slug at runtime. For any page, the following hooks are automatically available:
This means if you have a custom page with the slug my-custom-page, you can hook into it with:

Where to Go From Here#

You now have the full picture of all available template hooks across every page in Twilight.
Next StepDescription
Component HooksLearn how to interact with Salla components via JavaScript as an app developer
Hooks OverviewGo back to the overview to understand how both hook types connect

Modified at 2026-05-07 11:36:04
Previous
Overview
Next
Component Hooks