bitexpert / sylius-minimum-order-value
Require a minium oder value to complete the order
Package info
github.com/bitExpert/sylius-minimum-order-value
Type:sylius-plugin
pkg:composer/bitexpert/sylius-minimum-order-value
Requires
- php: ^8.2
- sylius/sylius: ^2.0
Requires (Dev)
- behat/behat: ^3.16
- bitexpert/phpstan-sylius: ^0.3.0
- dbrekelmans/bdi: ^1.4
- 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
- friends-of-behat/variadic-extension: ^1.6
- madewithlove/license-checker: ^3.1
- nyholm/psr7: ^1.8
- phpstan/phpstan: ^2.3
- phpstan/phpstan-doctrine: ^2.0
- phpstan/phpstan-symfony: ^2.1
- phpstan/phpstan-webmozart-assert: ^2.0
- phpunit/phpunit: ^10.5
- sylius-labs/coding-standard: ^4.4
- sylius-labs/suite-tags-extension: ~0.2
- sylius/sylius-rector: ^3.9
- sylius/test-application: ^2.0.0@alpha
- symfony/browser-kit: ^6.4 || ^7.4
- symfony/debug-bundle: ^6.4 || ^7.4
- symfony/dotenv: ^6.4 || ^7.4
- symfony/http-client: ^6.4 || ^7.4
- symfony/intl: ^6.4 || ^7.4
- symfony/runtime: ^6.4 || ^7.4
- symfony/web-profiler-bundle: ^6.4 || ^7.4
- symfony/webpack-encore-bundle: ^2.2
- vincentlanglet/twig-cs-fixer: ^4.1
Suggests
None
Provides
None
Conflicts
- symfony/flex: <2.2
- symplify/easy-coding-standard: <12.0
- thecodingmachine/safe: <2.0
Replaces
None
This package is auto-updated.
Last update: 2026-10-26 19:25:43 UTC
README
The Minimum Order Value plugin for Sylius allows admin users to define a minimum order value per channel. Orders whose items total (the value of the products in the cart, excluding shipping and order-level discounts) is below that value cannot be completed.
Installation
- Install the package via Composer:
composer require bitexpert/sylius-minimum-order-value
- Enable the plugin in your
config/bundles.php:
return [ // ... BitExpert\SyliusMinimumOrderValuePlugin\BitExpertSyliusMinimumOrderValuePlugin::class => ['all' => true], ];
- Import plugin configuration
# config/packages/bitexpert_sylius_minimum_order_value.yaml imports: - { resource: "@BitExpertSyliusMinimumOrderValuePlugin/config/config.yaml" }
- Modify
Channelentity
Let App\Entity\Channel\Channel entity implement the BitExpert\SyliusMinimumOrderValuePlugin\Entity\MinimumOrderValueAwareInterface and
add the BitExpert\SyliusMinimumOrderValuePlugin\Entity\MinimumOrderValueTrait trait:
<?php declare(strict_types=1); namespace App\Entity\Channel; use BitExpert\SyliusMinimumOrderValuePlugin\Entity\MinimumOrderValueAwareInterface; use BitExpert\SyliusMinimumOrderValuePlugin\Entity\MinimumOrderValueTrait; use Sylius\Component\Core\Model\Channel as BaseChannel; class Channel extends BaseChannel implements MinimumOrderValueAwareInterface { use MinimumOrderValueTrait; }
- Update your database:
./bin/console doctrine:migrations:diff ./bin/console doctrine:migrations:migrate
Customizing the calculation
Every place that evaluates the minimum order value (workflow guard, checkout form validation)
depends on BitExpert\SyliusMinimumOrderValuePlugin\Checker\MinimumOrderValueCheckerInterface.
A service alias points the interface at the default MinimumOrderValueChecker, so you can swap
in your own implementation without touching the plugin — useful when the default comparison
(e.g. order.itemsTotal < minimum * 100) does not match your requirements:
<?php declare(strict_types=1); namespace App\Checker; use BitExpert\SyliusMinimumOrderValuePlugin\Checker\MinimumOrderValueCheckerInterface; use Sylius\Component\Core\Model\OrderInterface; final class CustomMinimumOrderValueChecker implements MinimumOrderValueCheckerInterface { public function isBelowMinimumOrderValue(OrderInterface $order): bool { // Your comparison logic, e.g. per product category or excluding promotions. } }
# config/services.yaml services: BitExpert\SyliusMinimumOrderValuePlugin\Checker\MinimumOrderValueCheckerInterface: class: App\Checker\CustomMinimumOrderValueChecker
Note:
the custom checker decides whether the checkout form rejects an order and whether the workflow guard blocks it.
The amount shown in the form error message (and the cart/checkout button disabling in Twig) is read from the
channel's minimumOrderValue directly — when a custom checker rejects an order without a channel value, the form
shows a generic error message without an amount.
Testing
vendor/bin/phpunit
License
The Minimum Order Value plugin for Sylius is released under the MIT license.
