This plugin allows customers to sign up for notifications when a product is back in stock.
composer require setono/sylius-restock-notification-plugin
Then, enable the plugin by adding it to the list of registered plugins/bundles
in the config/bundles.php
file of your project before (!) SyliusGridBundle
and the FrameworkBundle
:
<?php
# config/bundles.php
return [
Setono\SyliusRestockNotificationPlugin\SetonoSyliusRestockNotificationPlugin::class => ['all' => true],
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
// ...
Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true],
];
Add this file to your config/routes
directory:
# config/routes/setono_sylius_restock_notification.yaml
setono_sylius_restock_notification:
resource: "@SetonoSyliusRestockNotificationPlugin/Resources/config/routes.yaml"
php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate
The plugin includes a command to remove old restock notification requests that are no longer needed. By default, it removes requests that are older than 90 days.
# Using the default threshold (90 days)
php bin/console setono:sylius-restock-notification:prune-requests
# Specifying a custom threshold (e.g., 30 days)
php bin/console setono:sylius-restock-notification:prune-requests --pruning-threshold=30
You can configure the default threshold in your application's configuration:
# config/packages/setono_sylius_restock_notification.yaml
setono_sylius_restock_notification:
pruning_threshold: 60 # Set the threshold to 60 days