Customizing Menus

Sylius provides various menus across its Shop and Admin interfaces — from customer account navigation to product form tabs and button groups. In Sylius 2.0, menu customization is handled in two main ways:

  • Twig hooks – the recommended and default approach for most Admin “action button” menus

  • Event listeners – still available for structural menus such as sidebars and tabs

This guide walks you through customizing each type.

Path: /admin/ Customization method: Event listener Add new items or groups to the expandable navigation menu on the left side of the admin panel.

To add items to the Admin panel menu, use the sylius.menu.admin.main event.

Step 1. Create a listener

<?php

namespace App\Menu;

use Sylius\Bundle\UiBundle\Menu\Event\MenuBuilderEvent;

final class AdminMenuListener
{
    public function addAdminMenuItems(MenuBuilderEvent $event): void
    {
        $menu = $event->getMenu();

        $newSubmenu = $menu
            ->addChild('new')
            ->setLabel('Custom Admin Menu')
        ;

        $newSubmenu
            ->addChild('new-subitem')
            ->setLabel('Custom Admin Menu Item')
        ;
    }
}

Step 2. Register your listener

After these steps, your custom menu item will appear at the bottom of the admin menu.

Admin Customer Show Menu

Path: /admin/customers/{id} Customization method: Twig hook Add action buttons (e.g. “Create Customer”) to the top-right corner of the customer detail view.

In Sylius 2.0, the customer show menu uses a Twig hook: sylius_admin.customer.show.content.header.title_block.actions.

Step 1. Configure your new hook for the custom action

Step 2. Add hook content

Admin Order Show Menu

Path: /admin/orders/{id} Customization method: Twig hook Add action buttons like “Complete Payment” to the order detail view.

This menu is built with a Twig hook: sylius_admin.order.show.content.header.title_block.actions.

Step 1. Configure your new hook for the custom action

Step 2. Add hook content


Admin Product Form Tabs

Path: /admin/products/new and /admin/products/{id}/edit Customization method: Twig hook Add custom tabs and form sections (e.g. for manufacturer details) to the product creation and edit forms.

This menu is built with the following Twig hooks:

/admin/products/new :

  • sylius_admin.product.create.content.form.side_navigation

  • sylius_admin.product.create.content.form.sections

/admin/products/{id}/edit:

  • sylius_admin.product.update.content.form.side_navigation

  • sylius_admin.product.update.content.form.sections

Step 1. Configure your new hook for the custom tab

The template attribute should point to the file rendering your additional form fields.

Step 2. Create templates for your tab (side_navigation) and content (sections)


Admin Product Variant Form Tabs

Path: /admin/products/{productId}/variants/create and /admin/products/{productId}/variants/{id}/edit Customization method: Twig hook Add extra tabs for variants, such as a custom media section.

This menu is built with the following Twig hooks:

  • /admin/products/{productId}/variants/create :

    • sylius_admin.product_variant.create.content.form.side_navigation

    • sylius_admin.product_variant.create.content.form.sections

  • /admin/products/{productId}/variants/{id}/edit:

    • sylius_admin.product_variant.update.content.form.side_navigation

    • sylius_admin.product_variant.update.content.form.sections

Step 1. Configure your new hook for the custom tab

Step 2. Create templates for your tab (side_navigation) and content (sections)

Shop Account Menu

Path: /account/dashboard/ Customization method: Event listener Add a custom entry to the customer panel’s sidebar navigation.

Step 1. Create a listener

In Sylius 2.0, menu icons use the Tabler icon set, not Semantic UI.

Step 2. Register your listener


Summary

If you're upgrading from Sylius 1.x and your menu customization is not working, check whether you're using a deprecated event and replace it with the appropriate Twig hook.

Last updated

Was this helpful?