=== Estimated Delivery Date for WooCommerce ===
Contributors: actpro
Tags: delivery date, estimated delivery, woocommerce, shipping date, delivery time
Requires at least: 6.2
Tested up to: 7.0
Requires PHP: 7.4
WC requires at least: 7.0
WC tested up to: 11.0.1
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Show an estimated delivery date on WooCommerce products, cart, checkout and emails. Delivery rules, cutoff countdown, holidays and zones.

== Description ==

**Estimated Delivery Date for WooCommerce** tells shoppers exactly when their order will arrive — before they buy. It shows a clear "get it by" delivery date on the product page, shop archive, cart, checkout and order emails, calculated from your own shipping rules rather than a guess.

Stores that show a delivery estimate convert better than stores that make customers wonder. "Arrives Thu, Aug 14 – Mon, Aug 18" answers the question that otherwise sends people to a competitor.

= How the delivery date is calculated =

You set a **delivery window in business days** (for example 2–5 days). The plugin counts forward from today, and automatically:

* skips weekends and any weekday you do not ship on
* skips your store holidays and closures
* rolls forward a day when an order is placed after your **order cutoff time**

So a 2–5 day window ordered on Friday afternoon shows the right dates, not dates that land on a Sunday when you are closed.

= Delivery rules: different dates for different products =

Not everything ships at the same speed. Build a rule from one or more conditions:

* **Product** — a specific product
* **Product category** — for example "Furniture ships slower"
* **Shipping class** — bulky items, fragile items
* **Shipping zone** — domestic versus international
* **Shipping method** — express versus standard

Rules combine with **is / is not** operators, and the **most specific matching rule wins automatically** — a product rule beats a category rule, which beats your store-wide default. You never have to drag rules into the right order.

= Urgency countdown =

A live **"Order within 2h 36m"** timer counts down to your dispatch cutoff, right next to the estimate. When the cutoff passes it does not vanish and leave shoppers guessing — it changes to "Cutoff passed — ships next business day" and the delivery date moves forward automatically.

= Everything else, in short =

* **Live admin preview** — a product-page mock-up that updates as you type, countdown included. What you see is what the storefront renders.
* **Per-product override** — a custom estimate, or no estimate at all, for individual products.
* **Scheduled start date** — count business days from a future date instead of today, per rule or per product. For pre-orders, restocks and launches.
* **Display control** — product page, shop/archive, cart (per item and overall), checkout and order emails, with position control on the product page.
* **Your wording, your branding** — message template with `{start}`, `{end}` and `{days}` tags, an icon picker (truck, calendar, clock, box) and an accent colour the badge tints itself from, so it suits any theme.
* **Shortcode** — `[edfw_estimated_delivery]` places the estimate anywhere.
* **Fast on large catalogues** — optional caching of calculated dates, invalidated automatically when you save; product and category pickers search on demand rather than loading everything.
* **Works with modern WooCommerce** — HPOS and the Cart & Checkout Blocks are both declared compatible.
* **Headless ready** — the estimate is exposed on the WooCommerce Products and Orders REST API and on the Store API.
* **Developer friendly** — dozens of documented actions and filters, and a rule-condition API add-ons can extend.

= Free, with no catches =

Every feature listed above is in the free plugin. Nothing is time-limited, usage-capped or hidden behind a licence key.

A separately sold premium upgrade adds stock-aware estimates (extra lead time for backordered and out-of-stock items) plus country and postcode targeting. You never need it for the features described here.

= Source code & build tools =

The admin settings screen is a React app compiled with `@wordpress/scripts`. The complete, human-readable source is included in the plugin's `src/` directory. To rebuild the compiled files in `build/`, run:

`npm install && npm run build`

== External services ==

This plugin uses the Freemius SDK for plugin registration, optional usage diagnostics, and licensing of the separately sold premium upgrade. Every feature of the free plugin works fully without it — nothing here is locked, limited, or licence-checked.

**When data is sent:** only after you explicitly opt in during activation. If you skip or decline the opt-in, no data is transmitted. You can opt out at any time from the plugin's settings screen.

**What is sent when you opt in:** your site URL, WordPress and PHP versions, active theme and plugin list, and the email address of the account you opt in with. This is used to notify you about updates and security notices, and to understand which environments the plugin runs on.

Service provided by Freemius, Inc.

* Terms of Service: https://freemius.com/terms/
* Privacy Policy: https://freemius.com/privacy/

== Installation ==

1. Upload the plugin to the `/wp-content/plugins/` directory, or install it through the Plugins screen.
2. Activate **Estimated Delivery Date for WooCommerce**.
3. Go to **WooCommerce → Estimated Delivery Date** to set up your rules, display locations, and holidays.

WooCommerce 7.0 or newer is required.

== Frequently Asked Questions ==

= How do I show an estimated delivery date on my WooCommerce product pages? =

Activate the plugin and go to WooCommerce → Estimated Delivery Date. A default rule is created for you, so an estimate appears on every product straight away. Adjust the Min/Max business days on the Delivery Rules tab, set your cutoff time and working days on General, and you are done.

= How is the delivery date calculated? =

The plugin takes the delivery window (Min–Max business days) from the most specific Delivery Rule that matches the product. It counts forward from today — or from the next working day if the order is placed after your cutoff time — skipping non-working weekdays and active holidays, and produces a date range.

= Can I set different delivery times for different products or categories? =

Yes. Add a rule targeting a product, category, shipping class, zone or method. A product rule automatically overrides a category rule, which overrides your store-wide default, so you never need to reorder rules. Individual products can also be overridden directly in the product editor.

= Can I exclude weekends and holidays from the delivery estimate? =

Yes. Choose which weekdays you dispatch on under General → Working schedule, and add one-off closures under Holidays. Both are skipped when counting business days, so an estimate never lands on a day you are closed.

= What is the order cutoff time? =

It is your daily deadline for same-day dispatch. Orders placed after it start counting from the next working day, so the estimate moves forward automatically. Shoppers see a live "Order within 2h 36m" countdown to that deadline.

= What does the countdown show after the cutoff time? =

It changes to "Cutoff passed — ships next business day" rather than disappearing, so shoppers are never left guessing, and the delivery window moves forward by one working day. The timer returns the next morning. The wording is translatable and filterable via `edfw_cutoff_passed_text`.

= Does it show the delivery date in the cart, checkout and order emails? =

Yes — per cart item, as an overall cart estimate, at checkout, and on order line items in emails and order screens. The estimate is frozen onto the order at checkout, so emails show what the customer was actually promised.

= What happens if a product matches no rule? =

No estimate is shown for that product. Keep a catch-all rule ("Product is Any → 2–5 days") as your store-wide default so every product shows something.

= Why does a product page show different dates than the admin preview? =

The live preview shows your store-wide default. A product matching a more specific rule uses that rule's window instead, so the dates can legitimately differ — the preview footer notes this.

= Does it work with page caching plugins? =

Yes. Calculated dates can be cached for performance, and that cache is refreshed automatically whenever you save settings.

= Is it compatible with HPOS and the block-based cart and checkout? =

Yes, both are declared compatible.

= Can I add the estimate somewhere my theme does not support? =

Use the `[edfw_estimated_delivery]` shortcode, or one of the plugin's filters. Developers can also read the estimate from the WooCommerce REST API and the Store API.

== Screenshots ==

1. General settings — cutoff, countdown and working schedule.
2. Display settings — locations, message template, icon and accent color.
3. Delivery Rules — the condition builder, with the live product preview.
4. Holidays & closures.
5. Advanced
6. Front View

== Changelog ==

= 1.0.0 =
* Initial release.
* Rule-based delivery estimates with automatic most-specific-rule matching.
* Order cutoff with live "Order within" countdown and a "Cutoff passed — ships next business day" note after the cutoff.
* Working schedule, holidays & closures, per-product overrides.
* Scheduled start date, per rule and per product.
* Display on product, shop, cart, checkout and order emails, with a live admin preview that matches the storefront exactly.
* Message template, icon picker and accent-tinted badge design.
* HPOS, Cart & Checkout Blocks, WooCommerce REST and Store API support.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
