leomoshko / sylius-tierprice-plugin
A plugin that allows to add tierprices to Sylius (fork of brille24/sylius-tierprice-plugin)
Package info
github.com/LeoMoshko/SyliusTierpricePlugin
Type:sylius-plugin
pkg:composer/leomoshko/sylius-tierprice-plugin
Requires
- php: ^8.2
- sylius/sylius: >=2.0 <2.3
Requires (Dev)
- behat/behat: ^3.16
- dmore/behat-chrome-extension: ^1.4
- dmore/chrome-mink-driver: ^2.9
- friends-of-behat/mink: ^1.11
- friends-of-behat/mink-browserkit-driver: ^1.6
- friends-of-behat/mink-debug-extension: ^2.1
- friends-of-behat/mink-extension: ^2.7
- friends-of-behat/page-object-extension: ^0.3
- friends-of-behat/suite-settings-extension: ^1.1
- friends-of-behat/symfony-extension: >=2.6.2 <2.7
- friends-of-behat/variadic-extension: ^1.6
- nyholm/psr7: ^1.8
- phpspec/phpspec: ^7.5
- phpstan/phpstan: ^1.12
- phpstan/phpstan-doctrine: ^1.3
- phpstan/phpstan-phpunit: ^1.4
- phpstan/phpstan-webmozart-assert: ^1.2
- phpunit/phpunit: ^10.5
- robertfausk/behat-panther-extension: ^1.1
- sylius-labs/coding-standard: ^4.4
- sylius-labs/suite-tags-extension: ~0.2
- sylius/sylius-rector: ^1.0
- symfony/browser-kit: ^6.4 || ^7.1
- symfony/debug-bundle: ^6.4 || ^7.1
- symfony/dotenv: ^6.4 || ^7.1
- symfony/flex: ^2.4
- symfony/http-client: ^6.4 || ^7.1
- symfony/intl: ^6.4 || ^7.1
- symfony/web-profiler-bundle: ^6.4 || ^7.1
- symfony/webpack-encore-bundle: ^2.2
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-02 08:32:23 UTC
README
This plugin adds tier pricing to Sylius: one product variant can have different prices based on the ordered quantity.
This is a fork of
brille24/sylius-tierprice-plugin, published asleomoshko/sylius-tierprice-plugin. The PHP namespace (Brille24\SyliusTierPricePlugin\) and the bundle class name are kept unchanged so it stays a drop-in replacement.
Requirements
| Package | Version |
|---|---|
| PHP | ^8.2 |
| Sylius | 2.0, 2.1, 2.2 |
Installation
- Install the plugin via composer:
composer require leomoshko/sylius-tierprice-plugin
- Register the bundle in your
config/bundles.php:
return [ // ... Brille24\SyliusTierPricePlugin\Brille24SyliusTierPricePlugin::class => ['all' => true], ];
- Import the plugin config in your
config/packages/brille24_sylius_tierprice_plugin.yaml:
imports: - { resource: '@Brille24SyliusTierPricePlugin/config/config.yaml' }
- For API functionality import the plugin routes in your
config/routes.yaml:
brille24_tierprice_bundle: resource: '@Brille24SyliusTierPricePlugin/config/routes.yml'
- Go into your
ProductVariantclass, implement the interface and add the trait plus one call in the constructor:
use Brille24\SyliusTierPricePlugin\Entity\ProductVariantInterface as TierPriceableProductVariantInterface; use Brille24\SyliusTierPricePlugin\Traits\TierPriceableTrait; use Sylius\Component\Core\Model\ProductVariant as BaseProductVariant; class ProductVariant extends BaseProductVariant implements TierPriceableProductVariantInterface { use TierPriceableTrait; public function __construct() { parent::__construct(); // Your constructor here $this->initTierPriceableTrait(); // "Constructor" of the trait } }
- Finally update the database schema (generate and run a migration) and install the assets:
bin/console doctrine:migrations:diff bin/console doctrine:migrations:migrate bin/console assets:install
Integration
- This plugin decorates the
sylius.calculator.product_variant_priceservice. If you wish to change that, you could register a compiler pass. - This plugin decorates the
sylius.order_processing.order_prices_recalculatorservice. If you wish to use your own order processor or change its priority, you could register a compiler pass. - The admin product-variant form and the shop product page are extended through Sylius Twig Hooks (
config/app/twig_hooks/), not menu listeners.
Usage
First set up a product with as many variants as you want. Then, for each variant, you can configure tier pricing per channel (and optionally per customer group). The table sorts itself automatically to give a clear overview of the configured tiers.
In the shop the customer sees a table next to the "add to cart" button showing the discount for the different tiers:
Creating data
You can create tier prices with fixtures:
sylius_fixtures: suites: my_suite: fixtures: tier_prices: options: custom: - product_variant: "20125148-54ca-3f05-875f-5524f95aa85b" channel: US_WEB quantity: 10 price: 5
The referenced product and product variant have to exist before the fixture runs.
Upgrading from brille24/sylius-tierprice-plugin
Because the namespace is unchanged, switching is a composer.json change only:
composer remove brille24/sylius-tierprice-plugin composer require leomoshko/sylius-tierprice-plugin
No code, config, template or translation-key changes are required.
Support
Found a bug or need help wiring the plugin into your Sylius project? Please open an issue on the issue tracker.
For paid support, Sylius integration or custom development, get in touch through our partner santv.fr.
Partners
This fork is maintained with the support of:
santv.fr — la tech au service de la santé et du développement des enfants.
License
Released under the MIT License.


