setono / sylius-out-of-office-plugin
Announce out-of-office / away periods in your Sylius store, with channel-aware, scheduled, per-placement messaging on the storefront.
Package info
github.com/Setono/sylius-out-of-office-plugin
Type:sylius-plugin
pkg:composer/setono/sylius-out-of-office-plugin
Fund package maintenance!
Requires
- php: >=8.1
- doctrine/collections: ^1.8 || ^2.0
- fakerphp/faker: ^1.20
- psr/log: ^1.0 || ^2.0 || ^3.0
- sylius/channel: ^1.0
- sylius/channel-bundle: ^1.0
- sylius/core: ^1.0
- sylius/core-bundle: ^1.0
- sylius/locale: ^1.0
- sylius/resource-bundle: ^1.11
- sylius/ui-bundle: ^1.0
- symfony/clock: ^6.4
- symfony/config: ^6.4
- symfony/dependency-injection: ^6.4
- symfony/event-dispatcher: ^6.4
- symfony/form: ^6.4
- symfony/http-foundation: ^6.4
- symfony/options-resolver: ^6.4
- symfony/routing: ^6.4
- twig/twig: ^2.12 || ^3.0
Requires (Dev)
- api-platform/core: ^2.7.16
- babdev/pagerfanta-bundle: ^3.8
- behat/behat: ^3.14
- doctrine/doctrine-bundle: ^2.11
- jms/serializer-bundle: ^4.2
- lexik/jwt-authentication-bundle: ^2.17
- setono/sylius-plugin-pack: ~1.14.1
- shipmonk/composer-dependency-analyser: ^1.6
- sylius-labs/polyfill-symfony-security: ^1.1.2
- symfony/debug-bundle: ^6.4
- symfony/dotenv: ^6.4
- symfony/intl: ^6.4
- symfony/property-info: ^6.4
- symfony/serializer: ^6.4
- symfony/web-profiler-bundle: ^6.4
- symfony/webpack-encore-bundle: ^1.17.2
- willdurand/negotiation: ^3.1
This package is auto-updated.
Last update: 2026-06-18 10:28:37 UTC
README
Announce an out-of-office / away period from the Sylius admin — with a start/end date, per-channel scoping and per-placement messaging — and surface it on the storefront top bar, product pages and checkout. Think of it as an email auto-responder for your store: set a date range, set a message, and customers are informed that orders placed now will ship when you are back.
Features
- Multiple, channel-aware, scheduled periods — stage next summer's holiday in advance, or run different messaging per channel.
- A master
enabledswitch independent of the dates, so you can flip a period on/off instantly. - Per-placement messages (top bar / product page / checkout) with sensible fallbacks, all translatable.
- Optional checkout blocking for periods where you genuinely cannot ship (off by default).
- Storefront integration through
sylius_uitemplate events, so it works across all Sylius 1.x minors with zero configuration.
Installation
This plugin targets Sylius 1.x, Symfony ^6.4 and PHP ≥ 8.1.
1. Require the plugin
composer require setono/sylius-out-of-office-plugin
The plugin is currently in alpha. If your project's
minimum-stabilityisstable, require it explicitly as a pre-release:composer require setono/sylius-out-of-office-plugin:^1.0@alpha.
2. Register the bundle
# config/bundles.php return [ // ... Setono\SyliusOutOfOfficePlugin\SetonoSyliusOutOfOfficePlugin::class => ['all' => true], ];
3. Import the routing
# config/routes/setono_sylius_out_of_office.yaml setono_sylius_out_of_office: resource: "@SetonoSyliusOutOfOfficePlugin/Resources/config/routes.yaml"
4. Update the database schema
Generate a migration for your application and run it:
bin/console doctrine:migrations:diff bin/console doctrine:migrations:migrate
The plugin deliberately does not ship its own migration — migrations belong to the application.
That's it — an Out of office entry appears in the admin under Configuration.
Storefront integration
The blocks are registered automatically (the plugin prepends the following sylius_ui configuration),
so there is nothing to do. The event ids below are the ones that exist in Sylius 1.x; copy this into
your app's configuration only if you want to re-prioritise, move or disable a block:
# config/packages/setono_sylius_out_of_office.yaml (optional override) sylius_ui: events: # Top bar — full-width announcement bar just after the header, above the page content sylius.shop.layout.before_content: blocks: setono_sylius_out_of_office_top_bar: template: '@SetonoSyliusOutOfOfficePlugin/shop/top_bar.html.twig' priority: 100 # Product show page sylius.shop.product.show.content: blocks: setono_sylius_out_of_office_product_notice: template: '@SetonoSyliusOutOfOfficePlugin/shop/product_notice.html.twig' priority: 100 # Checkout — complete/summary step sylius.shop.checkout.complete.summary: blocks: setono_sylius_out_of_office_checkout_notice: template: '@SetonoSyliusOutOfOfficePlugin/shop/checkout_notice.html.twig' priority: 100
Note: the notices depend on wall-clock time, so if you put a full-page cache (Varnish / Symfony HttpCache) in front of the shop, render these blocks via ESI / edge fragments or keep a short TTL — otherwise a bar may stick around (or fail to appear) until the page cache expires.
Configuration
The resource model classes are overridable through the standard Sylius resources configuration, e.g.:
# config/packages/setono_sylius_out_of_office.yaml setono_sylius_out_of_office: resources: out_of_office_period: classes: model: App\Entity\OutOfOffice\OutOfOfficePeriod
Customization
- Templates, grid and form follow standard Sylius override rules — drop a file in
templates/bundles/SetonoSyliusOutOfOfficePlugin/to restyle the bar/notices. The markup uses stable hook classes (setono-out-of-office-bar,setono-out-of-office-notice) and minimal inline styling. - Checkout behavior: each period has a
checkoutBehaviorofallow(default — informational only) ordisable(blocks order completion via asylius.order.pre_completeguard and shows a notice).
Single source of truth
The active period is resolved by ActiveOutOfOfficePeriodProviderInterface, which the templates, the
checkout guard and your own code all go through. In Twig:
{% if setono_sylius_out_of_office_is_active() %}
{{ setono_sylius_out_of_office_active_period().topBarMessage }}
{% endif %}
Development
This plugin was scaffolded from the Setono Sylius plugin skeleton
(1.14.x) with php init answered as org Setono and plugin name SyliusOutOfOffice.
composer install (cd tests/Application && yarn install && yarn build) (cd tests/Application && bin/console assets:install) (cd tests/Application && bin/console doctrine:database:create) (cd tests/Application && bin/console doctrine:schema:create) (cd tests/Application && bin/console sylius:fixtures:load -n) (cd tests/Application && symfony serve)
Admin credentials in the test application: sylius / sylius.
Quality tooling:
composer analyse # PHPStan (level max) composer check-style # ECS composer fix-style # ECS autofix composer phpunit # PHPUnit (functional tests run when a database is available) vendor/bin/infection # mutation testing
License
This plugin is released under the MIT License.