Customizing Grids
Grids in Sylius are responsible for rendering lists of entities in the administration panel, such as products, customers, or orders. You can customize grids declaratively in YAML or programmatically using event listeners.
Why Customize a Grid?
Typical use cases include:
Removing or modifying fields
Changing or disabling filters
Adjusting grid actions (e.g., buttons)
Reordering items
Programmatically extending grids with PHP
YAML-Based Customizations
The recommended and most common way to customize grids in Sylius 2.0 is by editing the config/packages/_sylius.yaml file.
✅ Removing a Field
# config/packages/_sylius.yaml
sylius_grid:
grids:
sylius_admin_product_review:
fields:
title:
enabled: falseThis will hide the title field on the product review grid.
✅ Modifying a Field
You can also localize the label using the translation system — see the Customizing Translations guide.
✅ Removing a Filter
✅ Removing an Action
This disables the delete action on each row.
✅ Modifying an Action
You can customize an action's label and destination route:
The show action doesn't exist on the product grid by default - make sure it is added first.
✅ Reordering Fields, Filters, or Actions
Use the position option to control order:
This reorders the fields top-to-bottom in the grid.
PHP-Based Customizations (via Events)
In Sylius 2.0, grids can also be extended programmatically. Each grid dispatches an event during configuration.
Example: Modifying the Product Grid in PHP
Let’s say we want to:
Remove the
imagefieldAdd a
variantSelectionMethodfield
Be careful not to re-add a field that already exists. Doing so will throw a LogicException.
Registering the Listener
Advanced configuration: Pagination Options
The following options are enabled by default on all grids:
These options improve pagination performance on large datasets (especially for databases with over 1M rows) but may increase the number of executed queries. If your use case requires disabling them, you can override them per grid:
Last updated
Was this helpful?
