Reserve Stock Plugin for Sylius.

Installs: 17 571

Dependents: 0

Suggesters: 0

Security: 0

Stars: 5

Watchers: 2

Forks: 2

Open Issues: 12


v1.3.1 2022-02-03 10:49 UTC


Latest Version on Packagist Software License Build Status Quality Score

This plugin will reserve items in your customers' carts in a given amount of time.


1. Composer

composer require setono/sylius-reserve-stock-plugin

2. Load bundle

Add to the bundle list in config/bundles.php:


return [
    // ...
    Setono\SyliusReserveStockPlugin\SetonoSyliusReserveStockPlugin::class => ['all' => true],
    // ...

3. Configuration

Default configuration is applied automatically. Find out which settings can be adjusted by running:

bin/console config:dump-reference SetonoSyliusReserveStockPlugin

The default configuration is:


    # Define the Time To Live (TTL) for a product reservation.
    ttl: 3600 # Example: 1800

4. Include repository

Option 1: load repository via config

This option applies if you didn't extend the OrderItem repository yet.

                repository: Setono\SyliusReserveStockPlugin\Repository\OrderItemRepository

Option 2: include repository trait in your repository

This option applies if you extended the OrderItem repository already. Add the trait to your repository class as shown in the example below. The package also comes with an interface (InCartQuantityForProductVariantOrderItemRepositoryAwareInterface) which you can optionally load.



namespace App\Repository\OrderItemRepository;

use Setono\SyliusReserveStockPlugin\Repository\InCartQuantityForProductVariantOrderItemRepositoryAwareInterface;
use Setono\SyliusReserveStockPlugin\Repository\ProductVariantCartOrderItem;
use Sylius\Bundle\OrderBundle\Doctrine\ORM\OrderItemRepository as BaseOrderItemRepository;

final class OrderItemRepository extends BaseOrderItemRepository implements InCartQuantityForProductVariantOrderItemRepositoryAwareInterface
    use ProductVariantCartOrderItem; // Load trait here