less than a minute read • Updated a month ago
Twig tags, filters, and functions reference
Reference for the Twig tags, filters, and functions available in Foxy templates, including custom filters and functions like money_format and generate_sso_token.
Allowed Twig functionality
Only the following built-in Twig functionality is available in Foxy templates:
Tags:
block,embed,if,import,include,for,macro,setFilters:
abs,capitalize,date,date_modify,default,escape,first,join,json_encode,keys,last,length,lower,merge,nl2br,number_format,round,slice,split,raw,replace,reverse,title,trim,upper,url_encodeFunctions:
block,date,random,template_from_string,min,max
Contact support if you need a tag, filter, or function that isn’t listed here.
Custom filters
Filter | Description | Example |
|---|---|---|
| Formats a number using the store’s currency formatting. |
|
| Pads a value to a given length. Parameters: length (default 30), pad string (default |
|
| Used to customize email subjects, from, and bcc addresses. | — |
Custom functions
Function | Description | Example |
|---|---|---|
| Adds the |
|
| Adds the |
|
| Returns a formatted city/state string. Takes an object with |
|
| Returns the correct language string for a country’s state or postal code field. Takes a 2-character country code. |
|
| Generates an SSO token for quick purchases from the receipt or reverse SSO logins. Only runs server-side — not available in client-side Twig.js. |
|
Notes
Use
rawwith caution, and never on user-supplied fields — it can introduce security vulnerabilities. Contact support to review your customizations if you’re unsure.