Skip to content

Document customization

The PDF documents are intentionally configuration-driven — most layout changes are switches and number inputs in plugin settings, not Twig template edits.

ChangeWhere
Add a product custom field as an extra columnPrint
Set that column’s widthAdditional column 1 width (px)
Show / hide photo, product number, manufacturer number, EANColumns to display in the items list
Choose which line-item types to printTypes of items to display
Hide digital itemsDon’t show digital items
Sort orderSort order + Sort direction
Group rows (Items List)Group by
Show / hide payment, shipping, summary blocks (Packing Slip)Show payment method / shipping method / order summary
Adjust font sizesFont size, Line item font size, Comment font size
Bold the customer commentBold font for comment
Highlight quantity > 1Highlight quantity switch

Each PDF type (Packing Slip, Items List) has its own card so the two layouts are tuned independently.

The custom-field selector accepts any product custom field. In your output:

  • The column title is the custom field’s label.
  • The cell value is the custom field’s value for that product, with no formatting beyond escaping.
  • Empty values render as an empty cell.

Use cases: warehouse location (storage_location), batch code, age-restriction flag, weight, packaging notes.

Three font-size knobs cover almost every readability need:

  • Font size — the base text size used for addresses, headers, footer.
  • Line item font size — usually larger than the base so pickers can read it at arm’s length.
  • Comment font size — the customer’s checkout note, sized independently from line items because the comment is “soft” content vs. the “hard” pick list.

The defaults — 12 / 14 / 12 — work for most A4 prints. Bump them up by 2 – 4 for thermal printers and large-format readability.

If switches and font sizes don’t cover what you need, the Twig templates live at:

src/Resources/documents/
view_orders.html.twig ← Packing Slips
view_items.html.twig ← Items List

These are standard Shopware Twig templates that can be overridden from your project (e.g. Resources/views/storefront/documents/ in your shop’s plugin / theme override). Common edits:

  • Custom header / footer with shop branding.
  • Conditional sections for specific sales channels or shipping methods.
  • Page break tweaks (Dompdf respects page-break-after: always etc.).

When overriding, keep in mind the document is rendered by Dompdf — CSS support is a subset of full browser CSS. Stick to layout primitives (table-based layouts, simple float / display rules, no flexbox / grid).

The “X / Y” page footer is added in PHP after Dompdf has rendered the document, by reading the Dompdf canvas. It’s not part of the Twig template — don’t try to add your own “page” placeholder, it will collide.