Everyone has the opportunity to be a pioneer.

Everyone has the opportunity to be a pioneer.

contact us

Tech Talk

Advanced Techniques for Customizing Sylius Stores

Egbert Wietses

06

.

06

.

2024

3 min read

a laptop open, with several lines of code on the screen
a laptop open, with several lines of code on the screen
a laptop open, with several lines of code on the screen

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:

yaml sylius_theme: sources: filesystem: directories: - '%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 themes/YourThemeName/templates/bundles/SyliusShopBundle/Product/show.html.twig.

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:

yaml sylius_theme: sources: filesystem: directories: - '%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 themes/YourThemeName/templates/bundles/SyliusShopBundle/Product/show.html.twig.

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:

yaml sylius_theme: sources: filesystem: directories: - '%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 themes/YourThemeName/templates/bundles/SyliusShopBundle/Product/show.html.twig.

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: bash 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.

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: bash 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.

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: bash 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: php 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

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

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

yaml winzou_state_machine: sylius_order_checkout: states: - cart - addressed - shipping_selected - payment_selected - completed transitions: custom_review: from: payment_selected to: custom_review complete: 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.

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:

yaml winzou_state_machine: sylius_order_checkout: states: - cart - addressed - shipping_selected - payment_selected - completed transitions: custom_review: from: payment_selected to: custom_review complete: 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.

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:

yaml winzou_state_machine: sylius_order_checkout: states: - cart - addressed - shipping_selected - payment_selected - completed transitions: custom_review: from: payment_selected to: custom_review complete: 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.yamlfile:

yaml framework: cache: app: cache.adapter.redis

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

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.yamlfile:

yaml framework: cache: app: cache.adapter.redis

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

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.yamlfile:

yaml framework: cache: app: cache.adapter.redis

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

Conclusion

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.

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.

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

Read More

related blogs

Read More

related blogs

Read More

Start the Conversation

Let’s talk about how custom software can solve your toughest challenges and drive growth.

Start the Conversation

Let’s talk about how custom software can solve your toughest challenges and drive growth.

sign up for the insights

amsterdam

rotterdam

portland

KvK: 81812620

VAT: NL862228852B01 

© 2025 Pionect. All rights reserved.

Start the Conversation

Let’s talk about how custom software can solve your toughest challenges and drive growth.

Start the Conversation

Let’s talk about how custom software can solve your toughest challenges and drive growth.

sign up for the insights

amsterdam

rotterdam

portland

KvK: 81812620

VAT: NL862228852B01 

© 2025 Pionect. All rights reserved.

Start the Conversation

Let’s talk about how custom software can solve your toughest challenges and drive growth.

Start the Conversation

Let’s talk about how custom software can solve your toughest challenges and drive growth.

sign up for the insights

amsterdam

rotterdam

portland

KvK: 81812620

VAT: NL862228852B01 

© 2025 Pionect. All rights reserved.

Start the Conversation

Let’s talk about how custom software can solve your toughest challenges and drive growth.

Start the Conversation

Let’s talk about how custom software can solve your toughest challenges and drive growth.

sign up for the insights

© 2025 Pionect. All rights reserved.