Skip to content

Rules and holidays

The plugin’s two most important configuration fields — Working days rule and Holidays rule — are pointers to Shopware Rule entities. 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.

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 rulesnot 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: Friday

or 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:

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 # Christmas

You 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.

The plugin’s installation help text suggests a workflow but doesn’t ship country-specific rules out of the box — each store defines its own. That’s a feature: you might ship from a country with different holidays than the country you sell to, or you might want to also block your team’s company holidays.

The two rules are applied sequentially:

  1. Start at today + 1 day.
  2. For each day in the future, check if it’s a holiday. If yes, skip.
  3. Otherwise check if it’s a working day. If not, skip.
  4. Count the surviving days until you’ve counted shippingMinDays working days — that’s the earliest shipping date.
  5. Continue until you’ve counted shippingMaxDays working days — that’s the latest shipping date.
  6. 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.

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.

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.