Problem
macjamati.si and a sister shop sell from the same warehouse, as two separate WordPress installs. The plugin they used read, changed and saved stock in separate steps, so two orders at the same moment could overwrite each other.
It also couldn't sync the products themselves without overwriting the sister shop's translations and its own edits.
What I did
- Designed it, wrote the design doc and built it with Claude Code as the coding agent; I made the design decisions, reviewed the changes and tested them.
- Made the main shop the only source of truth: the sister shop sends each order as a change (−n, or +n for a refund) with an idempotency key; main applies it atomically and sends back the new quantity. A retried request can't count twice.
- "Sync until edited": the sister shop remembers a hash of each field as sync last wrote it. If the field changes there (translation, import, direct edit), sync stops overwriting it and shows main's change as a note.
- Signed every request between the shops (HMAC, single-use nonces, one-time pairing codes) and fixed everything two security reviews found before going live.
- Queued product updates and merged repeated saves within 30 seconds; stock changes take a separate path that is never merged, with retries backing off up to 12 hours.
Result
Swipe sideways to see the whole chart →
Stack
- PHP 8.3
- WordPress
- WooCommerce
- REST API
- Action Scheduler
- WP-CLI
- PHPUnit
- PHPCS