Skip to content

Cart Process

The Cart Process handles the entire lifecycle of a customer's shopping cart during their visit on the website — from creation to placing an order.


Purpose

The cart process ensures that customers can collect, modify, and ultimately convert products into an order. The shopping cart serves as temporary storage for product configurations and quantities before an order is formally created.

Core functions

  • Create a shopping cart when the first product is added
  • Add and remove products
  • Update quantities and product configurations
  • Convert a shopping cart into an order

Involved Services

Service Responsibility
zwerfkei-website Customer-facing frontend where the shopping cart is displayed and managed.
zwerfkei Core engine for product catalog, pricing, and stock.
zwerfkei-backend New backend that acts as a middleware layer between the website and the core engine.

Process Flows

General process flow

The diagram below shows how the services collaborate when a customer interacts with the shopping cart:

sequenceDiagram
    actor Customer
    participant Website as zwerfkei-website
    participant Backend as zwerfkei-backend
    participant Core as zwerfkei

    Customer->>Website: Add product to cart
    Website->>Backend: API call: add product
    Backend->>Core: Fetch product data & stock
    Core-->>Backend: Product info & availability
    Backend-->>Website: Cart updated
    Website-->>Customer: Display cart

    Customer->>Website: Change quantity
    Website->>Backend: API call: update quantity
    Backend->>Core: Recalculate price
    Core-->>Backend: Updated pricing
    Backend-->>Website: Cart updated
    Website-->>Customer: Show updated cart

    Customer->>Website: Place order
    Website->>Backend: API call: create order
    Backend->>Core: Create order from cart
    Core-->>Backend: Order confirmation
    Backend-->>Website: Order created
    Website-->>Customer: Redirect to payment process

Future architecture

In the future, this architecture can be transformed for the Brekz platform. In that case, zwerfkei-website is replaced by brekz-website and zwerfkei-backend by brekz-backend, without a dependency on the zwerfkei core service.


Cart Subfeatures

Add product

When a customer adds a product to the cart, the product including its configuration (size, colour, quantity) is stored in the cart. The backend validates whether the product is available and calculates the current price.

Update cart

Customers can change quantities or remove products. With every change, the total price is recalculated by the backend.

Cart to order

When the customer decides to checkout, the shopping cart is converted into a formal order. This is the transition to the Order Management process.

flowchart LR
    A[Shopping Cart] -->|Checkout| B[Create Order]
    B --> C[Payment Process]
    C --> D{Payment successful?}
    D -->|Yes| E[Order confirmed]
    D -->|No| F[Back to cart]