Back to the Carter-Cash experience

Carter-Cash

Persistent Cart & Cross-Device Journeys

01 / 4

JOURNEY CONTINUITY

Resuming a cart on any device

Letting customers continue shopping after signing out, losing a session, or switching devices

Originally, the cart relied mainly on the browser session. After a period of inactivity, signing back in, or moving to another device, customers could lose their active cart and have to start over.

I redesigned cart initialization so it no longer depended only on that session. When a customer signs in, the system can retrieve their latest valid cart from the database and restore it to the journey. If no cart can be resumed, a new one is created for the customer’s current context.

  • Continuity
  • Session
  • E-commerce

02 / 4

CONTEXT RULES

Reconciling cart, identity, and store

Selecting the right cart without losing the context in which the purchase began

Several states could exist at sign-in: an anonymous cart in the current session, an earlier cart still active in the database, or a store that differed from the one previously associated with the customer. Sales associate accounts also required behavior distinct from standard customer accounts.

I structured the rules used to resolve these situations. An anonymous cart can be assigned to the customer who has just signed in; when none exists, the latest valid cart is retrieved. The cart’s store and the session’s store are then synchronized according to context. Customers recover their shopping environment, while sales associate use remains isolated in a dedicated cart.

  • Business rules
  • Identity
  • Store context

03 / 4

JOURNEY ANALYTICS & DATA

Understanding cross-device journeys

Making device changes visible throughout the shopping journey

Cart continuity allowed customers to keep shopping, but it also raised a new question: how did a journey that began on mobile, desktop, or tablet progress through to the order?

I designed tracking for the devices used at key stages of the cart: creation, device change, entry into payment, and completion. Rules ensure that only consistent transitions are recorded, and an aggregated view makes the main cross-device journeys available for analysis. I supported this feature through its production release.

  • Cross-device
  • Behavioral analytics
  • Production

04 / 4

TECHNICAL IMPLEMENTATION

Structuring cart continuity with Symfony

Cart continuity had to reconcile several sources of state: the session, the authenticated customer, and the database, while preserving the selected store. Cross-device tracking then had to observe that journey without becoming tightly coupled to checkout

  • Symfony
  • Doctrine
  • PHPUnit

Cart initialization

A central Symfony service coordinates the different cases: a cart already in the session, assigning an anonymous cart after sign-in, retrieving the latest valid cart, or creating a new one. A Doctrine repository selects the reusable cart based on the state of its related order.

Identity and store context

The rules explicitly distinguish customers from sales associates. The cart also retains its store so a resumed journey can reconcile the saved context with the new session.

Event-driven tracking

EventDispatcher decouples device logging from the main business journey. Events are dispatched at meaningful stages, then a service applies integrity rules, detects the device type, and records only relevant transitions. A SQL view aggregates completed journeys.

Testing and reliability

PHPUnit covers the main initialization scenarios: creation, assignment after sign-in, database retrieval, and sales-associate-specific handling. Security, session, repository, and Doctrine dependencies are mocked to isolate the business rules.

  • Symfony
  • Doctrine
  • EventDispatcher
  • Security
  • Session
  • DQL
  • Mobile Detect
  • PHPUnit