Contents (3)
A WooCommerce–ERP or inventory integration meets duplicate messages, out-of-order delivery and temporary outages in production. The design should treat these as normal.
Idempotency: one effect per message
Store a unique ID for each event and check it hasn’t been processed before acting on it.
if ( get_transient( 'erp_event_' . $event_id ) ) {
return new WP_REST_Response( null, 200 ); // already handled
}
set_transient( 'erp_event_' . $event_id, 1, DAY_IN_SECONDS );
as_enqueue_async_action( 'hamidarab_erp_apply', [ $event_id ], 'erp' );
Respond fast, process in a queue
The receiving endpoint should only validate, record and answer quickly; the real work runs in Action Scheduler so the sender’s timeout doesn’t trigger a resend.
Ordering and versions
If events can arrive out of order, compare a version or last-modified time instead of applying them blindly.
A transient is enough as an idempotency key without a persistent object cache, but at scale a dedicated table with a unique index is safer.
$ ./request_review
Facing the same problem in your own store?
Senior WordPress and WooCommerce backend engineering for complex production problems.
Request a Technical Assessment
## Comments