Rules and holidays
The plugin’s two rule fields — Working days rule and Additional holidays rule — are pointers to Shopware Rule entities. Public holidays and the shop’s own days off are kept on the Calendar tab; the holidays rule adds further dates to them. This keeps your date logic in the same place as every other shipping/payment/checkout rule, and lets you reuse the same rule across plugins.
How the plugin evaluates rules
Section titled “How the plugin evaluates rules”Internally the plugin builds a custom rule scope (P2Lab\EstimatedDelivery\Rule\Scope\DateRuleScope) that exposes a specific date to the matched conditions. Then it walks the next ~100 calendar days and, for each day, asks the rule “do you match this date?”.
- For the working-days rule, a day that matches the rule is a working day.
- For the holidays rule, a day that matches the rule is a holiday and is excluded even if it falls on a working day.
The resulting list of locked days is what the plugin uses when adding “1 working day” or “3 working days” to the order date.
Conditions that work with the working-days rule
Section titled “Conditions that work with the working-days rule”Any condition that can be evaluated against a date works. The most common ones:
- Day of the week is one of — the standard way to mark Mon–Fri (or Mon–Sat for couriers).
- Date range — exclude specific date ranges (factory shutdown, summer holiday).
- Customer rules / Cart rules — not useful here, because the rule is evaluated against a hypothetical future date, not against a real cart.
A typical working-days rule:
ANY of - Day of the week is one of: Monday - Day of the week is one of: Tuesday - Day of the week is one of: Wednesday - Day of the week is one of: Thursday - Day of the week is one of: Fridayor equivalently with the Day of the week is one of condition (multi-select):
Day of the week is one of [Mon, Tue, Wed, Thu, Fri]Conditions that work with the holidays rule
Section titled “Conditions that work with the holidays rule”The holidays rule is almost always built from Date range conditions OR’d together. A Date range condition always contains the year, so a rule of this kind needs new conditions every year; the Calendar tab repeats yearly holidays on its own.
ANY of - Date range = 2026-01-01 .. 2026-01-01 # New Year - Date range = 2026-04-06 .. 2026-04-06 # Easter Monday - Date range = 2026-05-01 .. 2026-05-01 # Labour Day - Date range = 2026-12-25 .. 2026-12-26 # ChristmasYou can group rules per country and load whichever one matches the shipping origin. Because the rule is just a pointer, you can switch between them per sales channel.
Public holidays on the Calendar tab
Section titled “Public holidays on the Calendar tab”The plugin contains the public holidays of Germany: the nine nationwide holidays and the holidays of the federal states. Import public holidays on the Calendar tab adds the selected holidays to the days off of a sales channel. Holidays that depend on Easter, such as Good Friday or Corpus Christi, are stored relative to Easter and fall on the correct date in every year.
The same tab holds the shop’s own days off, such as a company holiday, and moves days off between sales channels and shops as a file. See Calendar.
Combining the two rules
Section titled “Combining the two rules”The two rules are applied sequentially:
- Start at today + 1 day.
- For each day in the future, check if it’s a holiday. If yes, skip.
- Otherwise check if it’s a working day. If not, skip.
- Count the surviving days until you’ve counted
shippingMinDaysworking days — that’s the earliest shipping date. - Continue until you’ve counted
shippingMaxDaysworking days — that’s the latest shipping date. - Repeat the process starting from the earliest shipping date, using the delivery rule and delivery min/max days, to get the delivery window.
This is why the shipping rule and the delivery rule are separate: your warehouse might close on Saturdays but the courier might deliver on them.
Performance
Section titled “Performance”The rule is loaded once per request and the locked-days array is computed once per sales channel. Repeated widget renders on the same page reuse the same calculation, so the rule lookup is cheap. If you have an unusually long min/max window (more than ~100 days) and need to extend the lookahead, drop us a note.
Debugging your rules
Section titled “Debugging your rules”The simplest way to sanity-check a rule is to use the live preview on the Widget tab. Change the cutoff time or toggle the holiday rule, save, and refresh — the displayed dates jump accordingly. Edge cases worth testing:
- An order placed Friday at 14:00 with a Friday cutoff of 13:00 should roll over to Monday.
- An order placed Friday at 14:00 with a Friday cutoff of 13:00 and Monday marked as a holiday should roll over to Tuesday.
- An order placed on a holiday — irrespective of weekday — should roll to the next non-holiday working day.