Sandi Verdev

Case study

Keeping two WooCommerce shops on one stock without overwriting their translations

WooCommerce plugin · macjamati.si ↗ · Oct 2026

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

How Multishop Sync keeps two shops in stepThe sister shop sends each order as a stock change with an idempotency key. The main shop applies it atomically and sends back the new absolute quantity. Product updates go field by field; a field edited on the sister shop since the last sync is kept and main's change is shown as a note. Every request is signed.macjamati.si · mainSister shopOrder placed: stock −n, idempotency keyApplied atomicallymain = one source of truthNew absolute quantityProduct update, field by fieldEdited here since last sync?yes: kept, change shownas a note · no: updatedEvery request signed: HMAC-SHA256,5-minute window, single-use nonce
Simplified message flow between the two shops.

Stack

  • PHP 8.3
  • WordPress
  • WooCommerce
  • REST API
  • Action Scheduler
  • WP-CLI
  • PHPUnit
  • PHPCS