-
A new
trackUsagefield has been added to promotions and promotion coupons. (#18966)When
trackUsageis disabled, the usage counter is neither incremented nor decremented when an order is placed or cancelled. This allows promotions and coupons to be used without affecting their usage statistics.The following methods have been added to their respective interfaces:
-
Sylius\Component\Promotion\Model\PromotionInterface:public function isTrackUsage(): bool; public function setTrackUsage(bool $trackUsage): void;
-
Sylius\Component\Promotion\Model\PromotionCouponInterface:public function isTrackUsage(): bool; public function setTrackUsage(bool $trackUsage): void;
If you have custom classes implementing these interfaces, you must add these methods. The default value is
true, preserving the previous behaviour. -
-
The
isTrackUsage(): boolmethod has been added toSylius\Component\Promotion\Generator\ReadablePromotionCouponGeneratorInstructionInterfaceIf you have a custom class implementing this interface, you must add this method.
-
The behaviour of the following eligibility checkers has changed — they now return
true(eligible) whentrackUsageis disabled, regardless of how many times the promotion or coupon has already been usedSylius\Component\Promotion\Checker\Eligibility\PromotionUsageLimitEligibilityCheckerSylius\Component\Promotion\Checker\Eligibility\PromotionCouponUsageLimitEligibilityChecker
This is consistent with the existing behaviour of
PromotionCouponPerCustomerUsageLimitEligibilityCheckerand prevents non-zero legacyusedcounters from blocking customers aftertrackUsageis turned off. -
The following usage modifiers now skip promotions and coupons that have
trackUsagedisabledSylius\Component\Core\Promotion\Modifier\OrderPromotionsUsageModifierSylius\Bundle\CoreBundle\Doctrine\ORM\Promotion\Modifier\AtomicOrderPromotionsUsageModifier
If you have decorated or extended these classes, verify that your implementation also respects the
isTrackUsage()flag. -
The
countByCustomerAndCoupon()method onSylius\Component\Core\Repository\OrderRepositoryInterfaceand its implementation inSylius\Bundle\CoreBundle\Doctrine\ORM\OrderRepositoryhas been deprecated and will be removed in Sylius 3.0.Use
countByCustomerAndCouponSince()instead, passingnullas the$sinceargument to replicate the previous behaviour:// Before $repository->countByCustomerAndCoupon($customer, $coupon); // After $repository->countByCustomerAndCouponSince($customer, $coupon, null);
-
The default value of
sylius_core.order_by_identifierhas been changed fromtruetofalse. (#18956)The
OrderByIdentifierSqlWalkeris no longer enabled by default. If your application relies on ordering by identifier, enable it explicitly in your configuration:sylius_core: order_by_identifier: true
-
Configuration changes related to the broadened Doctrine support (see the Dependencies section). These only matter once you opt into DoctrineBundle 3 / DBAL 4:
-
The
auto_generate_proxy_classes: "%kernel.debug%"option was removed from Sylius' Doctrine configuration (it no longer exists in DoctrineBundle 3, and since PHP 8.4 Doctrine uses native lazy objects). If you are still on DoctrineBundle 2 and rely on this behavior, set it explicitly in your own application configuration. -
The ORM metadata/query/result cache configuration was switched from wrapped
Doctrine\Common\Cacheservices to PSR-6 cache pools (type: pool). This change lives in the application configuration (config/packages/{prod,test}/doctrine.yaml), which is not updated automatically on existing installations, update those files in your project accordingly:doctrine: orm: entity_managers: default: metadata_cache_driver: - type: service - id: doctrine.system_cache_provider + type: pool + pool: doctrine.system_cache_poolAs part of this switch, the
doctrine.result_cache_provideranddoctrine.system_cache_providerservices (defined in Sylius' application configuration, wrapping the PSR-6 pools viaDoctrine\Common\Cache\Psr6\DoctrineProvider) were removed. If you referenced them by id, use the cache pools directly (doctrine.system_cache_pool,doctrine.result_cache_pool) withtype: poolas shown above. -
On PostgreSQL, Sylius now forces the
SEQUENCEidentity generation strategy (identity_generation_preferencesforPostgreSQLPlatform) to keep the database schema backward compatible with existing installations.
-
-
The
_sylius: redirect:block has been removed from thesylius_shop_order_payroute definition.Previously,
PayumPayResponseProviderread the after-pay redirect route at runtime from the routing metadata:# ShopBundle/Resources/config/routing/order.yml (removed) sylius_shop_order_pay: defaults: _sylius: redirect: route: sylius_shop_order_after_pay
The redirect route is now resolved from the
sylius_shopbundle configuration at compile time. If you customized the after-pay redirect route for Payum, use the dedicated Payum configuration keys instead:sylius_shop: order_pay: payum_after_pay_route: sylius_shop_order_after_pay payum_after_pay_route_parameters: []
Note: The
after_pay_routeandafter_pay_route_parameterskeys are reserved for the Payment Request flow and their default parameters include Payment Request-specific values (e.g.hash: paymentRequest.getHash()). Do not use them to configure the Payum after-pay redirect. -
The
RequestConfigurationtype has been replaced byRequestin all payment processing interfaces and their implementations.If you implemented or decorated any of the following interfaces, update your method signatures accordingly:
-
Sylius\Bundle\CoreBundle\OrderPay\Provider\PayResponseProviderInterface:-public function getResponse(RequestConfiguration $requestConfiguration, OrderInterface $order): Response; -public function supports(RequestConfiguration $requestConfiguration, OrderInterface $order): bool; +public function getResponse(Request $request, OrderInterface $order): Response; +public function supports(Request $request, OrderInterface $order): bool;
-
Sylius\Bundle\CoreBundle\OrderPay\Provider\AfterPayResponseProviderInterface:-public function getResponse(RequestConfiguration $requestConfiguration): Response; -public function supports(RequestConfiguration $requestConfiguration): bool; +public function getResponse(Request $request): Response; +public function supports(Request $request): bool;
-
Sylius\Bundle\PaymentBundle\Provider\HttpResponseProviderInterface:-public function supports(RequestConfiguration $requestConfiguration, PaymentRequestInterface $paymentRequest): bool; -public function getResponse(RequestConfiguration $requestConfiguration, PaymentRequestInterface $paymentRequest): Response; +public function supports(Request $request, PaymentRequestInterface $paymentRequest): bool; +public function getResponse(Request $request, PaymentRequestInterface $paymentRequest): Response;
-
Sylius\Bundle\PaymentBundle\Processor\HttpResponseProcessorInterface:-public function process(RequestConfiguration $requestConfiguration, PaymentRequestInterface $paymentRequest): ?Response; +public function process(Request $request, PaymentRequestInterface $paymentRequest): ?Response;
-
Sylius\Bundle\CoreBundle\OrderPay\Handler\PaymentStateFlashHandlerInterface:-public function handle(RequestConfiguration $requestConfiguration, string $state): void; +public function handle(Request $request, string $state): void;
-
-
MetadataInterfaceandRequestConfigurationFactoryInterfacehave been removed from the constructors ofOrderPayControllerandPaymentRequestPayAction.If you extended or decorated either of these classes, update their constructors:
-
Sylius\Bundle\CoreBundle\OrderPay\Controller\OrderPayController:public function __construct( private OrderRepositoryInterface $orderRepository, - private MetadataInterface $orderMetadata, - private RequestConfigurationFactoryInterface $requestConfigurationFactory, private iterable $payResponseProviders, private iterable $afterPayResponseProviders, ) {} -
Sylius\Bundle\CoreBundle\OrderPay\Action\PaymentRequestPayAction:public function __construct( - private MetadataInterface $paymentRequestMetadata, - private RequestConfigurationFactoryInterface $requestConfigurationFactory, private PaymentRequestRepositoryInterface $paymentRequestRepository, private HttpResponseProcessorInterface $httpResponseProcessor, private UrlProviderInterface $afterPayUrlProvider, ) {}
-
-
The payment encryption (
sylius_payment.encryption) got two new options to harden decryption of gateway configs and payment requests. Both are opt-in and keep the previous behavior by default.-
strict_mode(defaultfalse): when enabled,Sylius\Component\Payment\Encryption\Encrypter::decrypt()throws anEncryptionExceptionfor data that is not encrypted, instead of silently returning it unchanged. Additionally,GatewayConfigEncrypterandPaymentRequestEncrypterthrow anEncryptionExceptionwhen the gateway config, payload or response data is only partially encrypted. By default (non-strict) they keep the previous lenient behavior: partially encrypted data is still decrypted based on its first element.sylius_payment: encryption: strict_mode: true
-
allowed_classes(defaulttrue): restricts which PHP classes may be instantiated while decrypting (theallowed_classesoption ofunserialize()). Usetrueto allow all classes (previous behavior),falseto allow none, or a list of class-strings to allow only specific ones. If you store objects in a gateway config or payment request payload (for example a payment plugin deserializing SDK objects such asStripe\PaymentIntent), add those classes to the list when narrowing it down.sylius_payment: encryption: allowed_classes: - 'Stripe\PaymentIntent'
The related encrypters gained a matching constructor argument, defaulting to the previous behavior:
-public function __construct(private readonly string $encryptionKeyPath) +public function __construct(private readonly string $encryptionKeyPath, private readonly bool $strictDecryption = false)
-public function __construct(private EncrypterInterface $encrypter) +public function __construct(private EncrypterInterface $encrypter, private array|bool $allowedClasses = true, private bool $strictMode = false)
Affected classes:
Sylius\Component\Payment\Encryption\Encrypter($strictDecryption),Sylius\Component\Payment\Encryption\GatewayConfigEncrypterandSylius\Component\Payment\Encryption\PaymentRequestEncrypter($allowedClassesand$strictMode). -
As part of the ongoing modernization of the Grid component, Sylius now provides grid definitions in both YAML and PHP.
Moving grid configuration to PHP provides several benefits:
- Better IDE support, including autocompletion and static analysis.
- Improved maintainability for complex grid definitions.
PHP grid definitions are the recommended approach going forward and represent the direction of Sylius 3.0. To support a smooth migration, Sylius continues to support legacy YAML-based grids and now allows you to choose which format is used for each grid.
During the migration period, grid definitions can be loaded from either:
- YAML (legacy format)
- PHP (recommended format)
You can configure the format globally:
sylius_core: grid: use_legacy_config: true # Use YAML grid definitions globally (default: false)
Or override the format for individual grids:
sylius_core: grid: grids: sylius_admin_product_variant: use_legacy_config: false # Use PHP configuration for this grid
This makes it possible to migrate grids incrementally rather than converting your entire application at once.
Important
A grid can only be loaded from a single source. YAML and PHP definitions for the same grid cannot be merged. When migrating a grid to PHP, you must recreate the complete grid definition in PHP, including any vendor configuration you want to preserve.
To simplify the conversion process, you can use the community-maintained Grid configuration converter:
The converter can help bootstrap the migration from YAML to PHP and reduce the amount of manual work required.
For a complete overview of the Grid component, see the Grid documentation.
-
The
sylius:install:setupcommand now sets up a country and a default zone during installation, and optionally assigns the created zone as the default channel tax zone.Three new setup classes have been introduced:
Sylius\Bundle\CoreBundle\Installer\Setup\CountrySetupimplementingCountrySetupInterfaceSylius\Bundle\CoreBundle\Installer\Setup\ZoneSetupimplementingZoneSetupInterfaceSylius\Bundle\CoreBundle\Installer\Setup\ChannelDefaultTaxZoneSetupimplementingChannelDefaultTaxZoneSetupInterface
All three are registered as services and injected into
SetupCommandas optional constructor arguments. If you have decorated or replacedSetupCommand, not passing them is deprecated and will be prohibited in Sylius 3.0:public function __construct( protected readonly EntityManagerInterface $entityManager, protected readonly CommandDirectoryChecker $commandDirectoryChecker, protected readonly CurrencySetupInterface $currencySetup, protected readonly LocaleSetupInterface $localeSetup, protected readonly ChannelSetupInterface $channelSetup, protected readonly FactoryInterface $adminUserFactory, protected readonly UserRepositoryInterface $adminUserRepository, protected readonly ValidatorInterface $validator, + protected readonly ?CountrySetupInterface $countrySetup = null, + protected readonly ?ZoneSetupInterface $zoneSetup = null, + protected readonly ?ChannelDefaultTaxZoneSetupInterface $channelDefaultTaxZoneSetup = null, ) -
The
ChannelSetupInterface::setup()method signature has been extended with an optional argument to receive the newly created country:public function setup( LocaleInterface $locale, CurrencyInterface $currency, + ?CountryInterface $country = null, ): void;If you have a custom implementation of
ChannelSetupInterface, update itssetup()signature accordingly.
-
The
behat/transliteratorpackage has been deprecated and will be removed in Sylius 3.0.Slug generation now primarily uses
symfony/string(Symfony\Component\String\Slugger\SluggerInterface). When no$sluggeris injected, the system falls back toBehat\Transliterator\Transliterator, but this fallback behavior is deprecated and will be removed in Sylius 3.0.The following classes have been updated — if you have extended or decorated them, update your constructor accordingly:
-
Sylius\Component\Product\Generator\SlugGenerator:-public function __construct() +public function __construct(private ?SluggerInterface $slugger)
Deprecated: Passing
nullas$slugger(or omitting it) is deprecated since Sylius 2.3. Whennullis passed, the generator falls back toBehat\Transliterator\Transliterator. Both the nullable argument and thebehat/transliteratorfallback will be removed in Sylius 3.0. -
Sylius\Component\Taxonomy\Generator\TaxonSlugGenerator:-public function __construct() +public function __construct(private ?SluggerInterface $slugger)
Deprecated: Same as above.
-
Sylius\Bundle\AdminBundle\Generator\TaxonSlugGenerator:public function __construct( private BaseTaxonSlugGeneratorInterface $slugGenerator, + private ?SluggerInterface $slugger, )Deprecated: Same as above.
-
-
The
StringInflector::nameToSlug()method has been deprecated and will be removed in Sylius 3.0. -
The minimum required PHP version has been raised from
^8.2to^8.3.Ensure your environment runs PHP 8.3 or higher before upgrading.
-
The
knplabs/gaufretteandknplabs/knp-gaufrette-bundlepackages have been removed.The Gaufrette integration has been unusable as a filesystem adapter. Since Sylius 2.0 the default filesystem adapter uses Flysystem instead.
If your application depends on the Gaufrette packages directly, require them explicitly in your
composer.json. -
The
symfony/proxy-manager-bridgeandfriendsofphp/proxy-manager-ltspackages have been removed.They are no longer needed, lazy services now rely on PHP's native lazy proxies provided by
symfony/var-exporter(the default since Symfony 6.4). No change is required in your application.If your application depends on these packages directly, require them explicitly in your
composer.json. -
The supported Doctrine version ranges have been broadened to allow the newer stack (
doctrine/doctrine-bundle^2.13 || ^3.0,doctrine/dbal^3.9 || ^4.0,doctrine/persistence^3.3 || ^4.0,doctrine/data-fixtures^1.7 || ^2.2).DBAL 4 removes the built-in
objectandarraycolumn types. Since Sylius maps two fields astype="object"(PaymentSecurityToken.detailsandPaymentRequest.payload), it registers a customSylius\Bundle\PaymentBundle\Doctrine\DBAL\Type\ObjectTypeto keep them working.
-
Passing an array of options to configure a Sylius validation constraint is deprecated since Sylius 2.3 and will be removed in Sylius 3.0. Use named arguments instead.
All Sylius validation constraints now declare explicit constructors with named arguments (marked with
#[HasNamedArguments]). The legacy array syntax keeps working, it only triggers deprecation.Configuring constraints via XML / YAML / PHP attributes is not affected and requires no changes; the validator loaders pass the options as named arguments automatically. Only direct instantiation in PHP should be migrated:
-new ProvinceAddressConstraint(['message' => 'My custom message']) +new ProvinceAddressConstraint(message: 'My custom message')
-
Several constraint message options have been renamed to follow the consistent
*Messageconvention. The old option names and public properties are deprecated since Sylius 2.3 and will be removed in Sylius 3.0. Both keep working and stay in sync in the meantime; switch to the new*Messagename:Constraint Old New ApiBundle\...\ChosenPaymentMethodEligibilitynotAvailable,notExist,paymentNotFoundnotAvailableMessage,notExistMessage,paymentNotFoundMessageApiBundle\...\ChosenPaymentRequestActionEligibilitynotAvailable,notExistnotAvailableMessage,notExistMessageApiBundle\...\AddingEligibleProductVariantToCartproductVariantNotSufficientproductVariantNotSufficientMessageApiBundle\...\ChangedItemQuantityInCartproductVariantNotLongerAvailable,productVariantNotSufficientproductVariantNotLongerAvailableMessage,productVariantNotSufficientMessagePromotionBundle\...\PromotionRuleType,PromotionActionType,CatalogPromotionActionType,CatalogPromotionScopeTypeinvalidTypeinvalidTypeMessagePaymentBundle\...\GatewayFactoryExistsinvalidGatewayFactoryinvalidGatewayFactoryMessageShippingBundle\...\ShippingMethodCalculatorExistsinvalidShippingCalculatorinvalidShippingCalculatorMessageShippingBundle\...\ShippingMethodRuleinvalidTypeinvalidTypeMessage
-
The Payment Request feature is no longer experimental.
The
@experimentalannotation has now been removed from all classes, interfaces, traits and attributes belonging to this feature acrossSylius\Component\Payment,Sylius\Bundle\PaymentBundle,Sylius\Bundle\PayumBundle, the order pay flow inSylius\Bundle\CoreBundle\OrderPayandSylius\Bundle\PayumBundle\OrderPay, and the Payment Request layer inSylius\Bundle\ApiBundle. These classes are now covered by the Sylius Backward Compatibility policy.
-
A new
getOrderAndItemPromotionTotal(): intmethod has been added toSylius\Component\Core\Model\OrderInterfaceand implemented inSylius\Component\Core\Model\Order.public function getOrderAndItemPromotionTotal(): int;
If you have custom classes implementing this interface without extending
Sylius\Component\Core\Model\Order, you must add this method.getOrderPromotionTotal()sumsORDER_UNIT_PROMOTION_ADJUSTMENT,ORDER_ITEM_PROMOTION_ADJUSTMENTandORDER_PROMOTION_ADJUSTMENTtogether. The unit-level adjustment is already netted into each item's subtotal (OrderItem::getSubtotal()), which is what the "Items total" row of the cart summary displays. Showing it again in the "Discount" row subtracted it twice, soItems total + Discount + shipping + taxdid not add up to the actual order total and the discount shown to the customer was larger than the one really applied.getOrderAndItemPromotionTotal()sums onlyORDER_ITEM_PROMOTION_ADJUSTMENTandORDER_PROMOTION_ADJUSTMENT, so it can safely be displayed next to "Items total". -
The shop cart summary and checkout summary now use
getOrderAndItemPromotionTotal()instead ofgetOrderPromotionTotal():@SyliusShop/cart/index/content/form/sections/general/summary/discount.html.twig@SyliusShop/checkout/common/sidebar/summary/total/promotion_total.html.twig
If you have custom templates, reports or integrations that display a promotion total next to
getItemsSubtotal()/getSubtotal(), switch them togetOrderAndItemPromotionTotal()to avoid the same double-counting.getOrderPromotionTotal()is unchanged and still returns the promotion's full effect.
-
Passing a
Sylius\Component\Core\Calculator\ProductVariantPricesCalculatorInterfacedirectly to the following catalog-facing classes is deprecated since Sylius 2.3. ImplementSylius\Component\Core\Calculator\CatalogPricesCalculatorInterfaceinstead, which extendsProductVariantPricesCalculatorInterfacewith no additional methods. It will be required in Sylius 3.0.Affected classes:
Sylius\Bundle\CoreBundle\Twig\PriceExtensionSylius\Bundle\ApiBundle\Serializer\Normalizer\ProductVariantNormalizerSylius\Bundle\ShopBundle\Twig\Component\Product\PriceComponentSylius\Bundle\ShopBundle\Twig\Component\Product\CardComponentSylius\Component\Core\Provider\ProductVariantMap\ProductVariantPriceMapProviderSylius\Component\Core\Provider\ProductVariantMap\ProductVariantOriginalPriceMapProviderSylius\Component\Core\Provider\ProductVariantMap\ProductVariantLowestPriceMapProvider
If you have a custom calculator used for catalog display, make it implement
CatalogPricesCalculatorInterface:use Sylius\Component\Core\Calculator\CatalogPricesCalculatorInterface; final class MyCustomCatalogPriceCalculator implements CatalogPricesCalculatorInterface { // ... }
This allows you to decorate catalog display pricing independently from cart/order pricing (
sylius.order_processing.order_prices_recalculator,sylius.filter.promotion.price_range), which remain onProductVariantPricesCalculatorInterface.