Advanced Techniques for Customizing Sylius Stores

image 2599

Customising Sylius stores can significantly enhance your e-commerce platform, offering tailored experiences to your customers. Here are some advanced techniques to consider:


Leveraging Custom Themes

One of the primary ways to customise your Sylius store is through custom themes. Sylius supports Twig templates, which allow you to create and modify the look and feel of your store. You can start by creating a new theme and extending the default Sylius templates. This approach lets you maintain the core functionality while adding unique design elements.

To create a custom theme, you first need to set up a theme directory and configure your config/packages/sylius_theme.yaml file. For example:

                - '%kernel.project_dir%/themes'


Within your theme directory, you can create subdirectories for templates, stylesheets, and JavaScript files. Override default templates by placing files in the corresponding directories. For example, to override the product page template, place your custom template in




Extending Core Functionality with Plugins

Sylius’s modular architecture allows for extensive customisation through plugins. You can either use existing plugins or create your own to add new features or modify existing ones. Plugins can extend any part of the Sylius platform, from product management to checkout processes.

To create a custom plugin, use the Sylius plugin skeleton as a starting point:

					composer create-project sylius/plugin-skeleton ProjectName

After setting up your plugin, you can define services, entities, and configurations to extend or modify Sylius’s core functionality. Register your plugin in the config/bundles.php file to enable it.


Customising the Admin Panel

The Sylius admin panel can be customised to fit your specific business needs. This can involve adding new fields, modifying existing forms, or changing the layout of the admin dashboard. To add custom fields to a product entity, for example, you can create an event listener that listens to form events and modifies the form accordingly.

Here’s a simple example of an event listener to add a custom field to the product form:

					namespace App\EventListener;

use Sylius\Bundle\ProductBundle\Form\Type\ProductType;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;

class ProductFormSubscriber implements EventSubscriberInterface
    public static function getSubscribedEvents()
        return [
            FormEvents::PRE_SET_DATA => 'onPreSetData',

    public function onPreSetData(FormEvent $event)
        $form = $event->getForm();
        $form->add('customField', TextType::class, [
            'label' => 'Custom Field',


Register this subscriber as a service in your services.yaml file.


Implementing Custom Checkout Flows

Sylius’s checkout process can be tailored to your business requirements by customising the checkout steps and workflows. You can add custom steps or modify existing ones by creating new state machine transitions and configuring them in the config/packages/sylius_order.yaml file.

For example, to add a custom review step before the payment step, you would define a new transition in the state machine configuration:

            - cart
            - addressed
            - shipping_selected
            - payment_selected
            - completed
                from: payment_selected
                to: custom_review
                from: custom_review
                to: completed


Create a custom controller and template for the new step, and update the checkout routes to include the latest step.


Enhancing Performance with Caching and Optimization

Performance is critical for any e-commerce platform. Sylius provides various tools and techniques to optimise performance, such as HTTP caching, query optimisation, and asynchronous processing.

Use Symfony’s HTTP cache to improve response times for frequently accessed pages. Configure the cache in your config/packages/framework.yaml file:

        app: cache.adapter.redis

Additionally, optimise database queries by using Doctrine’s query builder and ensuring that your database schema is properly indexed.



Customising Sylius stores involves a mix of theme development, plugin creation, admin panel customisation, checkout flow modification, and performance optimisation. By leveraging these advanced techniques, you can create a highly customised and efficient e-commerce platform tailored to your business needs. Always refer to the Sylius documentation for detailed guidance and best practices.

Related blogs

Want to get in touch and learn more about what we can do? We love to just have a chat digital or in person.