Diagramate

E-commerce Order System Class Diagram Template

Class diagram with Customer, Order, OrderItem, Product and Payment classes, showing composition, associations and multiplicities. For online shop system design and object-oriented coursework, exported as PNG, Word or PowerPoint for free.

owns

contains

refers to

settled by

1

1

*

1

*

1..*

1

0..1

Customer

+String customerId

+String displayName

+String phone

+placeOrder() : Order

Order

+String orderNo

+Date createdAt

+String status

+pay()

+cancel()

+total() : float

OrderItem

+int quantity

+float unitPrice

+subtotal() : float

Product

+String sku

+String name

+float price

+int stock

+reduceStock(int)

Payment

+String transactionId

+float amount

+String channel

+refund()

Previewed in the “Indigo” theme; you can switch themes in the editor
Open in the editorFree · No sign-up · No watermark

Edit the text, pick a theme, export Word / PowerPoint / PDF

When to use it

System design documents for shops, object-oriented analysis and design assignments and project reports. Order and OrderItem use composition (filled diamond) because an item cannot exist without its order; Order and Payment are a 0..1 association.

Making it yours

  • Add Cart, Coupon or Shipment classes as class Name { … } blocks and connect them.
  • Turn the status into an enumeration: class OrderStatus { <<enumeration>> PENDING PAID SHIPPED }.
  • Change composition to aggregation by replacing *-- with o--; use a plain --> when unsure.

Mermaid code

classDiagram
    class Customer {
        +String customerId
        +String displayName
        +String phone
        +placeOrder() Order
    }
    class Order {
        +String orderNo
        +Date createdAt
        +String status
        +pay()
        +cancel()
        +total() float
    }
    class OrderItem {
        +int quantity
        +float unitPrice
        +subtotal() float
    }
    class Product {
        +String sku
        +String name
        +float price
        +int stock
        +reduceStock(int)
    }
    class Payment {
        +String transactionId
        +float amount
        +String channel
        +refund()
    }
    Customer "1" --> "*" Order : owns
    Order "1" *-- "1..*" OrderItem : contains
    OrderItem "*" --> "1" Product : refers to
    Order "1" --> "0..1" Payment : settled by

Ask an AI for one with this structure

Send the prompt below to ChatGPT or Claude, then paste the whole reply into the editor; the code inside is detected automatically.

Draw an e-commerce order system class diagram in Mermaid classDiagram syntax with classes Customer (customerId, displayName, phone; method placeOrder), Order (orderNo, createdAt, status; methods pay, cancel, total), OrderItem (quantity, unitPrice; method subtotal), Product (sku, name, price, stock; method reduceStock), Payment (transactionId, amount, channel; method refund). Customer has many Orders; Order is composed of one or more OrderItems; OrderItem refers to one Product; Order is settled by zero or one Payment. Output only the mermaid code block.

FAQ

Composition or aggregation?

Composition when the part cannot exist without the whole (an order item without its order is meaningless); aggregation when the part can stand alone (a product exists without any order).

Can a class diagram show the order of method calls?

No, it is a static structure. Use a sequence diagram for call order; the "Microservice call sequence diagram" template is a starting point.

Too many attributes make the diagram tall

Keep only the key attributes and move the full list to a data dictionary, or split the diagram into "customers and orders" and "products and stock".

More in this category

All templates

Updated 2026-09-05