Twig Hooks & PDF template

Use Twig Hooks to place or tweak refund UI in Admin, and override the Credit Memo PDF for branding/legal content. The Refund Plugin ships its own Twig Hooks config and a ready-to-override PDF template.

Where the plugin defines hooks

Plugin hook configuration: config/twig_hooks/ in the RefundPlugin. This directory contains YAML files that register hookables used by the plugin’s Admin views. (GitHubarrow-up-right)

Where the plugin defines hooks. The Invoicing Plugin ships its own hook configuration in the repository: config/twig_hooks/ (see plugin source). Review these files to learn which hooks/blocks it registers and their priorities. (GitHubarrow-up-right)

Override or move the credit memo list (example)

# config/packages/sylius_twig_hooks.yaml
sylius_twig_hooks:
  hooks:
    # target a real Shgop Order Show hook; order and exact names visible in the Profiler
    'sylius_shop.account.order.show.content.main.credit_memos':
        list:
           template: 'shop/order/credit_memos/list.html.twig'
           priority: 20   # higher renders earlier
circle-check

Credit Memo PDF: file to override

Override path in your project (Symfony convention)

Copy the file to your app and keep the relative path:

Then customize header/logo/typography/legal notes.

Acceptance checks

Troubleshooting

  • Hook doesn’t show → wrong hook name or too-low priority. Inspect Profiler → Twig Hooks; adjust priority. (Sylius Documentationarrow-up-right)

  • PDF missing → install wkhtmltopdf or set WKHTMLTOPDF_PATH; or disable PDFs if you don’t need them. (GitHubarrow-up-right)

  • Can’t find plugin hooks → browse the plugin’s config/twig_hooks/ to see shipped hookables and mirror their names in your app config. (GitHubarrow-up-right)

Last updated

Was this helpful?