Amirali YaghoutiSenior Software Engineer

webapp Case study

Jeweltimeco Camera-to-Cart App

Every watch in the JewelTime inventory has its own unique code, not just a SKU shared across identical items. That makes the phone camera the fastest way for a sales consultant on the floor to get a specific physical piece onto a specific customer's invoice.

The business problem

A consultant standing with a customer needs the item in the cart in seconds, and the item is a particular physical piece with its own code, not just a model. Typing a code is slow and error-prone, and the underlying question — is this exact piece still available, or has it been reserved or already invoiced — cannot be answered from the WooCommerce stock field at all.

What I delivered

  • A scanner in the catalog and brand views of the PWA, on a floating button that stays reachable one-handed.
  • Native BarcodeDetector where the browser provides it, with a ZXing fallback where it does not, so the flow works across the devices the team actually carries.
  • Resolution from the scanned unique code to its order code and product, then an add with a reservation check rather than a bare stock check.
  • Explicit handling for the states that occur in a real shop: the piece is already assigned to another customer, the scanned code does not match the expected product, or stock is short.
  • A manual-without-code path for the case where every piece is reserved and the consultant confirms they are proceeding anyway.
  • A product trace tool that takes a unique code and reports whether it is in stock, reserved or invoiced, with the linked invoice and customer when it has been consumed.
  • Inventory upload by CSV or XLSX keyed on order code and unique code, which upserts active codes, deactivates missing ones and marks products out of stock when no active code remains.

Technical approach

  • Inventory truth lives in a unique-code table, not in the WooCommerce stock field. That is what makes reservation state a real answer instead of a count.
  • The scanner degrades rather than requiring a specific browser: BarcodeDetector when available, ZXing when not, and the manual path when neither helps.
  • Every failure state is named and handled separately. In a shop, a scan that silently does nothing is worse than one that says the piece is already on someone else's invoice.
  • Uploads produce a downloadable report of order codes that matched no product, so an import problem is visible instead of being absorbed.
  • Scanning is scoped to the consultant and above in the role model; a guest or customer session never reaches it.

Result and evidence

Consultants add a specific physical item to an invoice by pointing a phone at it, and the reservation state is checked as part of that action rather than discovered later at fulfilment. Product trace answers the where-is-this-piece question directly, which was previously a conversation between three people.

Commercial value

Jewellery retail is per-item, not per-SKU, and the operational cost of losing track of which physical piece went where is high. Tying the camera to the unique-code table is what makes the rest of the invoicing workflow trustworthy.

implementation-brief.readme

Readable implementation brief

implementation_brief {
  project: "JewelTime Camera-to-Cart"
  stack: "PHP endpoints + vanilla JS SPA, PWA with service worker"
  scanner: "BarcodeDetector, ZXing fallback, manual path"
  resolves: "unique code -> order code -> product"
  truth: "unique-code inventory table, not Woo stock field"
  states: "already assigned, product mismatch, short stock,
           fully reserved (manual override on confirmation)"
  trace: "unique code -> in stock / reserved / invoiced,
          with linked invoice and customer"
  ingest: "CSV/XLSX upsert, deactivates missing codes,
           reports unmatched order codes"
  access: "sales consultant role and above"
}

What this project shows

The interesting part is not the scanner, it is what the scan resolves against. Building the unique-code inventory table first is what made a camera feature worth having.

Enumerating the failure states explicitly — assigned, mismatched, short, fully reserved — is the difference between a demo that scans and a tool a shop can run on a Saturday.