setono/sylius-restock-notification-plugin

Plugin that allows customer to sign up for notifications when a product is back in stock

Fund package maintenance!
Setono

Installs: 81

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 3

Type:sylius-plugin

v0.2.0 2020-09-01 08:59 UTC

This package is auto-updated.

Last update: 2025-05-28 10:31:10 UTC


README

Latest Version Software License Build Status Code Coverage Mutation testing

This plugin allows customers to sign up for notifications when a product is back in stock.

Installation

composer require setono/sylius-restock-notification-plugin

Enable the 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],
];

Import routes

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"

Update your database schema

php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate

Maintenance

Pruning Old Notification Requests

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