Twig variables & examples
In the Twig editors (line items table and summary) the usual variables of the Shopware document templates are available. This page summarizes the most important ones.
Availability per editor
order
✅
✅
lineItems
– (via loop)
✅
lineItem
✅ (per position)
–
config
✅
–
hueRenderPhase
✅
–
currencyIsoCode
✅
set it yourself
languageId
✅
–
billingAddress
✅
–
The summary is rendered server-side and only receives
orderandlineItems. Set helper variables such ascurrencyIsoCodeyourself there, e.g.{% set currencyIsoCode = order.currency.isoCode %}.
Order (order)
order.orderNumber
Order number
order.amountNet
Net total of the order
order.amountTotal
Gross total of the order
order.price.totalPrice
Grand total
order.price.rawTotal
Raw total (before rounding)
order.price.calculatedTaxes.sortByTax
Taxes, sorted by tax rate
order.price.taxStatus
gross or net
order.shippingTotal
Shipping costs
order.currency.isoCode
Currency ISO code (e.g. EUR)
order.deliveries.first.shippingMethod.translated.name
Name of the shipping method
order.deliveries.first.getShippingOrderAddress
Delivery address
order.totalRounding, order.itemRounding
Rounding settings
Position (lineItem)
lineItem.label
Label
lineItem.quantity
Quantity
lineItem.unitPrice
Unit price
lineItem.totalPrice
Total price of the position
lineItem.payload.productNumber
Product number
lineItem.payload.options
Variant options (group / option)
lineItem.payload.features
Product features (e.g. reference price)
lineItem.price.taxRules
Tax rates of the position
Configuration (config)
config.displayLineItems
Display positions?
config.displayPrices
Display prices?
config.displayLineItemPosition
Display position number?
config.displayAdditionalNoteDelivery
Additional delivery note
config.deliveryCountries
Delivery countries (IDs)
config.fileType
File type of the rendered document
Useful filters
`{{ value
currency(currencyIsoCode, languageId) }}`
`{{ value
sw_sanitize }}`
`{{ 'snippet.key'
trans }}`
Example: output the variant options of a position
Example: output the tax rates of a position
Tip: Since the bundled default templates match Shopware's standard layout exactly, they are the best reference for available variables and their usage. Load the default template and work your way forward from there.
Zuletzt aktualisiert