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. (GitHub)

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. (GitHub)

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

Credit Memo PDF: file to override

  • Source template inside the plugin: templates/download/credit_memo.html.twig. (GitHub)

Override path in your project (Symfony convention)

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

templates/bundles/SyliusRefundPlugin/download/credit_memo.html.twig

Then customize header/logo/typography/legal notes.

Acceptance checks

  • Your hookable renders on Admin → Order → Show in the position you expect (verify in Profiler → Twig Hooks). (Sylius Documentation)

  • Overridden PDF renders with your branding from templates/bundles/SyliusRefundPlugin/.... (Sylius Documentation)

Troubleshooting

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

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

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

Last updated

Was this helpful?