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.
- 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:migrateEvery 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\CustomMinimumOrderValueCheckerNote:
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.
vendor/bin/phpunitThe Minimum Order Value plugin for Sylius is released under the MIT license.
