Resource & Grid

The Invoice is a first-class Sylius Resource. It’s exposed in the Admin as a read-only listing (index) with a “Download PDF” action. You can extend the grid (fields/filters/actions) like any other Sylius grid.

Resource

You can find registered resources by running the command:

bin/console sylius:debug:resource | grep sylius_invoicing

Extending the Invoice grid

Base grid name: sylius_invoicing_invoice. You can add columns, filters, and actions via standard grid config.

Add/adjust columns (Example)

# config/packages/sylius_grid.yaml
sylius_grid:
  grids:
    sylius_invoicing_invoice:
      fields:
        number:
          type: string
          label: sylius_invoicing.ui.invoice_number
        issued_at:
          type: datetime
          label: sylius_invoicing.ui.issued_at
        order_number:
          type: string
          label: sylius.ui.order
          path: order.number
        customer_email:
          type: string
          label: sylius.ui.customer
          path: order.customer.email

Where do invoice files live?

  • When the target state is reached (e.g., paid / created per your config), an immutable PDF is written to the configured directory..

  • There’s no direct DB relation between Invoice and the file. The path is resolved from the invoice number by a provider service.

Order page integration

The Order → Invoices block on the Admin order view is injected via Twig Hooks in Sylius 2.x (replacing the old Sonata events). If you want to move or restyle it, see Extension Points → Twig Hooks & PDF Templates.

Verify your changes

  1. Routes: bin/console debug:router | grep invoic

  2. Grid config loaded: bin/console debug:config sylius_grid | less

  3. UI check: open Admin → Invoices and confirm new columns/filters/actions.

Last updated

Was this helpful?