Functions

View the available functions within your Twig template.

Functions generate content for you to use within your templates.

If you'd like us to add a function that caters to your needs please let us know via the suggestions board.

Available Functions

FunctionDocumentation

__

_p

config

asset

path

query

range

Function Documentation

__

Returns the equivalent translation from within your translations settings.

{{ __('Redeem coupons / gift cards') }}

// prints "Redeems coupons / gift cards" (Or the equivalent translation if another language is selected)

_p

Returns the plural translation from within your translation settings.

{{ _p(":count items for :amount :currency", basket.packages|length, {'count' : basket.packages|length, 'amount' : basket.price|money, 'currency' : basket.currency}) }}

// prints "5 items for $5.00 USD"

config

Returns a config value from your template config schema.

{{ config("header-colour") }}

// prints the associated config value with the key header-colour

asset

Returns the full url path of an asset from within your template.

{{ asset("style.css") }}

// Prints the URL of style.css, such as https://your-store.tebex.io/template-assets/style.css"

path

Returns the full url path of the current page.

{{ path() }}

// Prints the full URL of the current page the customer is browsing on your store

query

Returns a GET parameter from the current url.

{{ query("test" }}

// Returns the GET param of "test" if it is provided in the URL.

Last updated