SyliusCon 2025
Early Bird Deal
LogoLogo
πŸ›£οΈ RoadmapπŸ’» Sylius DemoπŸ’¬ Community Slack
  • Sylius Documentation
  • Sylius Plugins
  • Sylius Stack
  • πŸ“–Sylius 2.0 Documentation
    • Organization
      • Release Cycle
      • Backwards Compatibility Promise
      • Sylius Team
      • Sylius Roadmap
  • Getting Started with Sylius
    • Installation
    • Basic Configuration
    • Shipping & Payment
    • First Product
    • Customizing the Shop
    • Customizing Business Logic
    • Using API
    • Installing Plugins
    • Deployment
    • Summary
  • The Book
    • Introduction to Sylius
    • Installation
      • System Requirements
      • Sylius CE Installation
        • Sylius CE Installation with Docker
      • βž•Sylius Plus Installation
      • Upgrading Sylius CE
      • Upgrading Sylius Plus
    • Architecture
      • Architecture Overview
      • Architectural Drivers
      • Resource Layer
      • State Machine
      • Translations
      • E-Mails
      • Contact
      • Fixtures
      • Events
    • Configuration
      • Channels
      • Locales
      • Currencies
    • Customers
      • Customer & ShopUser
      • βž•Customer Pools
      • AdminUser
      • Addresses
        • Countries
        • Zones
        • Addresses
        • Address Book
    • Products
      • Products
      • Product Reviews
      • Product Associations
      • Attributes
      • Pricing
      • Catalog Promotions
      • Taxons
      • Inventory
      • βž•Multi-Source Inventory
      • Search
    • Carts & Orders
      • Orders
      • Cart flow
      • Taxation
      • Adjustments
      • Cart Promotions
      • Coupons
      • Payments
      • 🧩Invoices
      • Shipments
    • Support
    • Contributing
      • Contributing Code
        • Submitting a Patch
        • ⚠️Security Issues
        • Coding Standards
        • Conventions
        • Sylius License and Trademark
      • Contributing Translations
      • Key Contributors
  • The Customization Guide
    • Customizing Models
      • How to add a custom model?
      • How to add a custom translatable model?
    • Customizing Forms
      • How to add a live form for a custom model?
    • Customizing Styles
    • Customizing Validation
    • Customizing Menus
    • Customizing Templates
    • Customizing Translations
    • Customizing Flashes
    • Customizing State Machines
    • Customizing Grids
    • Customizing Fixtures
    • Customizing API
    • Customizing Serialization of API
    • Customizing Payments
      • How to integrate a Payment Gateway as a Plugin?
  • πŸ§‘β€πŸ³The Cookbook
  • How to resize images?
  • How to add one image to an entity?
  • How to add multiple images to an entity?
  • Sylius 1.X Documentation
    • πŸ““Sylius 1.x Documentation
Powered by GitBook
LogoLogo

Developer

  • Community
  • Online Course

About

  • Team

Β© 2025 Sylius. All Rights Reserved

On this page
  • Why Customize a Grid?
  • YAML-Based Customizations
  • PHP-Based Customizations (via Events)
  • Advanced configuration: Pagination Options

Was this helpful?

Edit on GitHub
  1. The Customization Guide

Customizing Grids

PreviousCustomizing State MachinesNextCustomizing Fixtures

Last updated 17 days ago

Was this helpful?

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.

If you’re new to Sylius grids, we recommend starting with the .

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: false

This will hide the title field on the product review grid.

βœ… Modifying a Field

# config/packages/_sylius.yaml
sylius_grid:
    grids:
        sylius_admin_product_review:
            fields:
                date:
                    label: "When was it added?"

You can also localize the label using the translation system β€” see the Customizing Translations guide.


βœ… Removing a Filter

# config/packages/_sylius.yaml
sylius_grid:
    grids:
        sylius_admin_product_review:
            filters:
                title:
                    enabled: false

βœ… Removing an Action

# config/packages/_sylius.yaml
sylius_grid:
    grids:
        sylius_admin_product_review:
            actions:
                item:
                    delete:
                        type: delete
                        enabled: false

This disables the delete action on each row.


βœ… Modifying an Action

You can customize an action's label and destination route:

# config/packages/_sylius.yaml
sylius_grid:
    grids:
        sylius_admin_product:
            actions:
                item:
                    show:
                        type: show
                        label: Show in the shop
                        options:
                            link:
                                route: sylius_shop_product_show
                                parameters:
                                    slug: resource.slug

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:

# config/packages/_sylius.yaml
sylius_grid:
    grids:
        sylius_admin_product_review:
            fields:
                status:
                    position: 1
                reviewSubject:
                    position: 2
                rating:
                    position: 3
                author:
                    position: 4
                date:
                    position: 5
                title:
                    position: 6

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 image field

  • Add a variantSelectionMethod field

<?php

namespace App\Grid;

use Sylius\Component\Grid\Event\GridDefinitionConverterEvent;
use Sylius\Component\Grid\Definition\Field;

final class AdminProductsGridListener
{
    public function editFields(GridDefinitionConverterEvent $event): void
    {
        $grid = $event->getGrid();

        $grid->removeField('image');

        $variantSelection = Field::fromNameAndType('variantSelectionMethod', 'string');
        $variantSelection->setLabel('Variant Selection');

        $grid->addField($variantSelection);
    }
}

Be careful not to re-add a field that already exists. Doing so will throw a LogicException.

Registering the Listener

# config/services.yaml
services:
    App\Grid\AdminProductsGridListener:
        tags:
            - { name: kernel.event_listener, event: sylius.grid.admin_product, method: editFields }

Advanced configuration: Pagination Options

The following options are enabled by default on all grids:

pagination:
    fetch_join_collection: true
    use_output_walkers: true

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:

# config/packages/_sylius.yaml
sylius_grid:
    grids:
        sylius_admin_product_review:
            driver:
                name: doctrine/orm
                options:
                    pagination:
                        fetch_join_collection: false
                        use_output_walkers: false

This is an optional performance optimization toggle - not required unless you encounter pagination or performance issues.

SyliusGridBundle documentation