A holiday store with a one-order-per-customer rule

Client
L'Orenta Nuts, gourmet nuts and candy (US)
My role
WooCommerce developer
Stack
WordPress, WooCommerce, PHP, JavaScript
L'Orenta Nuts website on desktop

The problem

For Christmas and New Year sales, L'Orenta runs a holiday version of the store with its own theme and prices. Deals were limited to one order per customer, but WooCommerce's built-in limit let customers buy again while their first order was still processing.

What I did

I set up the holiday store on a subdomain with the same features as the main shop. Before checkout, a check looks up the customer's email against earlier purchases of that product, including orders still processing, and stops a second order.

The result

Each customer can claim a holiday deal once, even while their earlier order is still being packed.