

The settings screen: the discount, how long the coupon lasts, and where the date is asked for.
Ask your customers for their date of birth in My Account or on the classic
checkout, and a daily job emails each of them a coupon a week before their birthday —
so it is in their inbox in time, and still valid on the day.
One customer, one coupon a year — and the claim is atomic. A daily job is
exactly the job that runs twice: WP-Cron spawns on page loads, so two visitors
landing in the same second can both start the run, and a store with a real
system cron and WP-Cron left on has two by construction. The year is claimed
with a single database insert that succeeds for exactly one caller, so the
customer gets one birthday coupon however many runs overlap.
A birthday is a day in your shop’s calendar, not an interval. It is worked
out in your store’s own timezone, so a shop in Auckland does not send its
coupons on the wrong day for four months of the year. And 29 February is
observed on 28 February in a common year, because somebody born on it has a
birthday every year.
A date of birth is personal data, and this plugin treats it as such. It is
stored on the customer’s account and nowhere else, shown back to them in My
Account so they can change or clear it, included in WordPress’ own
personal-data export, removed by its erasure request, and deleted when the
plugin is uninstalled. The coupons themselves are never deleted: a code you
have already emailed is a promise.
The full edition — Gatemi Birthday Coupons for WooCommerce, a separate
plugin sold on gatemi.com — adds a coupon on the anniversary of the day each customer joined
(which needs nothing from them at all), a head start of up to 60 days before
the birthday, your own subject and message for each email, your
own code prefix, a minimum the coupon may be spent against, a required date of
birth at the checkout, and a Birthday column on the Users list. Your settings
and every date carry over, and a customer who has already had this year’s
coupon here is never sent a second one.