The one thing a delivery estimate is judged on is whether the date was right. Four rules follow from that, and both editions keep all four.
Rule 1: no lead time, no estimate
A shop that has typed no lead time gets no estimate anywhere — not an invented "3–5 days". And a cart holding even one product the shop cannot quote gets no estimate either: a date that is right for four lines and wrong for the fifth is wrong.
Rule 2: working days, on the store's clock
The start day
- Take the current time in your site's time zone (Settings → General → Timezone). A shopper in another time zone is told your warehouse's truth.
- If today is not a working day, or it is at or after your cutoff, the start day is the next working day.
- Otherwise the start day is today.
The cutoff moves the start, not the end. Subtracting a day from the arrival instead would quietly turn a two-day promise into a one-day one.
Counting
From the start day, step forward one calendar day at a time and count only working days, until the lead time is used up. A day is a working day when it is one of your Days you work and — full edition — not on your holiday list. If the count lands on a day you do not work, it moves on to the next working day.
With a lead time of 0, the arrival is the start day itself.
A worked example
Working days Monday to Friday, cutoff 15:00, lead time 2–4 days, and a holiday on Monday 25 May (full edition).
| Shopper visits | Start day | Earliest (+2) | Latest (+4) |
|---|---|---|---|
| Tuesday 10:00 | Tuesday | Thursday | Monday |
| Tuesday 15:30 | Wednesday | Friday | Tuesday |
| Friday 22 May, 16:00 | Tuesday 26 May (Monday is a holiday) | Thursday 28 May | Monday 1 June |
Rule 3: a range, never a pretend single day
A lead time is a range. "2 to 4 days" shown as "arrives Tuesday" is wrong two times in three. The range collapses to one date only when both ends land on the same day, because "12 March – 12 March" reads as a bug:
- different days: "Arrives between 14 March and 18 March"
- the same day: "Arrives 14 March"
Dates are written with WordPress' wp_date(), so month and day names come out in your site's language.
Which lead time a product uses
- The product's own lead time (Product data → Inventory), if it has one.
- Full edition: otherwise the slowest lead time among its categories and their parent categories. A product filed under both "In stock" and "Made to order" takes the made-to-order time.
- Otherwise the shop's lead time.
- Otherwise none — and no estimate.
Which lead time a cart uses
A parcel leaves when its last item is ready, so a cart is quoted by its slowest line: the largest earliest and the largest latest across every product in it. If any line has no lead time at all, the cart has no estimate (Rule 1).
Rule 4: one calculator — and the order keeps its promise
The product page, the cart and the checkout all ask the same calculator, so a product page promising Thursday and a checkout promising the following Tuesday cannot happen.
The exception is deliberate. When an order is placed on the classic checkout, the cart's two dates are written onto the order (_gmde_earliest and _gmde_latest). From then on, the order confirmation page, My Account → Orders and every order email read the dates back off the order instead of working them out again. Those dates are what you promised at the time; an order looked at a month later still says what it said.
Where it is shown
| Place | Hook |
|---|---|
| Product page | in the product summary, after the price and short description |
| Cart | the cart totals, above the order total |
| Checkout | the order review, above the order total |
| Order confirmation and My Account order view | after the order table |
| Order emails (HTML and plain text) | after the order details |
These are WooCommerce's classic template hooks. The Cart and Checkout blocks do not run them, so there the estimate is printed just after the block (render_block_woocommerce/cart and …/checkout), and a block order records its promise on woocommerce_store_api_checkout_update_order_from_request.
Full edition: Show it on hides it on any of the first three; the [gatemi_delivery_estimate] shortcode shows it anywhere else.
The free and full editions together
Both editions read the same gmde_settings option and the same _gmde_min_days / _gmde_max_days meta on products, and write the same two dates onto orders. The free edition ignores category lead times, holidays, placements, wording and date format; it counts only your working days and uses your site's date format. Upgrading turns those on with nothing to re-enter.
