=== Do It Simply Booking Follow-Up ===
Contributors: baperrou
Tags: woocommerce, bookings, follow-up, email
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Sends a follow-up email to the customer a set number of days after their WooCommerce Booking has ended.

== Description ==

Do It Simply Booking Follow-Up adds a simple, configurable follow-up email to your WooCommerce Bookings workflow. Set how many days after a booking ends you want the email to go out, choose which booking statuses trigger it, and write your message using the built-in visual editor.

**Features**

* Sends one follow-up email per booking — a duplicate-prevention flag ensures the email is never sent twice even if WP-Cron fires more than once.
* Choose which booking statuses are eligible (complete, paid, confirmed on by default).
* Fully customisable From name, From email, subject, heading, and body.
* Emails are wrapped in the WooCommerce email template automatically — no extra templates to manage.
* Supports placeholders: `{first_name}`, `{product_name}`, `{booking_date}`, `{site_name}`.
* "Send test email" button on the settings page so you can preview the layout before going live.
* All processing uses site timezone — no server-timezone surprises.

**Requirements**

* WooCommerce
* WooCommerce Bookings (premium extension — not available on WordPress.org)

If WooCommerce Bookings is not active, the plugin will display an admin notice and load nothing else.

== Installation ==

1. Upload the `do-it-simply-booking-follow-up` folder to `/wp-content/plugins/`.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. Go to **WooCommerce → Booking Follow-Up** to configure the settings.
4. Enable sending, set your delay and message, then save.

== Frequently Asked Questions ==

= Does this work without WooCommerce Bookings? =

No. WooCommerce Bookings (sold separately at WooCommerce.com) must be installed and active. If it is not found, the plugin shows an admin notice and does not load.

= When exactly does the email send? =

The plugin schedules a once-daily WP-Cron event that fires at **9:00 am in your site's timezone** (as set under Settings → General). On activation it calculates the next upcoming 9:00 am and uses that as the first run time, so subsequent runs stay anchored to that hour. Each run looks for bookings that ended on the whole calendar day that is exactly your configured number of days ago — for example, setting 3 means bookings that ended 3 days ago (any time that day, 00:00–23:59 in the site timezone). The email is sent once per booking; a flag is stored on the booking to prevent duplicates.

Developers can change the send hour via a filter in a custom plugin or `functions.php`:

`add_filter( 'dis_bfu_send_hour', fn() => 7 ); // run at 7 am instead`

The filter value must be an integer between 0 and 23.

= WP-Cron isn't firing reliably — what can I do? =

WP-Cron depends on site visits to trigger scheduled events. For reliable timing, set up a real server cron job to hit `wp-cron.php` on a schedule, for example:

`0 6 * * * wget -q -O - https://example.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1`

= Can I resend an email for a booking? =

Delete the `_dis_bfu_sent` post meta from the booking in the database (or via a custom snippet) and the next cron run will treat it as unsent — provided it still falls within the configured day window.

= The test email worked but live emails are not sending =

Make sure **Enable Follow-Up Emails** is checked and saved, and that the booking status you are testing with is ticked in the **Booking Statuses** list.

== Changelog ==

= 1.0.0 =
* Initial release.
