WooCommerce estimated delivery date on product pages
Published 4 min read
WooCommerce shows delivery information nowhere on the product page. Shoppers have to reach checkout to find out when something will arrive, which is often too late to change a purchasing decision. Stores that add an estimate earlier, on the product page itself, consistently see higher conversion on time-sensitive orders.
When stores do add a delivery estimate, the date is usually wrong. Not because of bad data, but because the math has several independent failure modes: the cutoff hour that moves afternoon orders to the next day, weekends that add delays at both ends of the window, a timezone setting that drifts twice a year, and page caching that serves yesterday's calculation to today's visitors.
When an afternoon order adds a full extra day
If your warehouse stops packing at 2pm, an order placed at 1:59pm ships today. An order at 2:01pm ships tomorrow. A simple 'ships in 1 to 3 business days' counter that starts from midnight ignores the cutoff entirely, so it shows the same window for a 10am order and a 4pm order on the same day. For stores with a meaningful volume of afternoon orders, the estimate is wrong for a large share of daily visitors.
The cutoff also interacts with the day of the week. A Friday 3pm order, with a 2pm cutoff, does not ship Monday morning - it ships Monday, counting Saturday and Sunday as non-working days. A Friday 1pm order ships the same day. The difference between those two is four calendar days of delivery window, and neither is captured by a static 'ships in X days' message.
Weekends delay the window at both ends
Most stores that account for weekends apply the adjustment to transit days only. A two-day transit dispatched Thursday arrives Monday, not Saturday. That part is straightforward. The less obvious half is packing: if a Saturday order cannot be packed until Monday, the packing day counter also needs to skip Saturday and Sunday.
Take a store with one packing day and two transit days. A Saturday order starts packing Monday, ships Tuesday, and arrives Thursday at the earliest. A plugin that skips weekends for transit but not packing shows 'arrives Wednesday' instead - it counts Saturday as packing day one, ships Sunday or Monday, and miscounts transit from there. The most visible version of this mistake is an 'arrives this weekend' estimate on a Saturday order.
The UTC offset that moves your cutoff twice a year
WordPress has two ways to set a timezone: a named location such as 'America/Chicago' and a fixed UTC offset such as 'UTC-5'. The named location tracks daylight saving time automatically. The fixed offset does not. Set your store to UTC-5 instead of America/Chicago, and a 2pm order cutoff silently becomes 3pm in summer and 2pm in winter, because the offset stays fixed while the region shifts.
Most store owners set the timezone once during setup and never revisit it. PHP's DateTimeZone will accept a city name and apply DST correctly, but falls back to the raw offset when the string is empty - which it is when a UTC offset was chosen instead of a city. The fix is in Settings > General > Timezone: switching from a UTC offset to the nearest major city.
Why the product page needs JavaScript for the date
Product pages get cached. If PHP calculates the delivery date during page rendering, the result is baked into the cached response and served unchanged to every visitor until the cache expires. A page generated at 11am, before cutoff, shows 'arrives Thursday' to someone visiting at 3pm - two hours past the cutoff - who should see Friday or later.
The plugin handles this by doing no date calculation in PHP. The cutoff hour, packing days, minimum transit days, and maximum transit days go into a JSON data attribute on the widget element. A small JavaScript function reads those values and calculates the delivery range from the visitor's current local time, on every page load. The widget markup is static and cacheable; the dates inside it are always current.
What you get
Included
- Delivery estimate widget on WooCommerce product pages with JavaScript-calculated dates
- Settings for cutoff hour, packing days, minimum and maximum transit days
- Weekend exclusions applied to both the packing window and the transit window separately
- Per-product packing days override via custom field on the product edit screen
Not included
- Public holiday calendars: carrier and national holidays need manual handling
- Shipping zone rules where different regions have different transit times
- Real-time carrier API calls for live shipping quotes
- Backorder and made-to-order products where the packing lead time varies
- Delivery estimate on the cart or checkout page, which falls within WooCommerce's own shipping display
Questions
My host's server-level cache runs before WordPress. Will the JavaScript date calculation still work?
Yes. The JavaScript runs in the browser after the page loads, regardless of how or when the HTML was generated. The widget placeholder arrives from the cache; the dates inside it are calculated fresh from the visitor's local time on every visit.
Build it in Steem
The button opens the builder with this guide's prompt filled in, so you can change anything before it runs. Nothing is built, and nothing is charged, until you send it.
Read the prompt (185 words)
Build a WordPress plugin that shows an estimated delivery date widget on WooCommerce single product pages. Add a settings panel under WooCommerce > Settings > Shipping with four fields: cutoff hour (default 14), packing days (default 1), minimum transit days (default 2), and maximum transit days (default 5). Store all four values in wp_options. On single product pages, insert a small widget below the add-to-cart button showing "Usually arrives [date] to [date]". Calculate the dates using JavaScript, not PHP, so the estimate stays fresh on cached pages. Output the four settings as a JSON object in a data attribute on the widget element. The JavaScript should: treat the order as placing today if the current local time is before the cutoff hour, otherwise treat it as placing tomorrow; skip Saturday and Sunday when counting packing days; skip Saturday and Sunday when counting transit days. Format output dates as abbreviated weekday, day number, and abbreviated month. Also add a custom field on the WooCommerce product edit screen for a per-product packing days override. When set and non-empty, use it instead of the global packing days setting.
Steem