Skip to content

Instantly share code, notes, and snippets.

@CiprianSpiridon
Last active June 3, 2025 07:18
Show Gist options
  • Select an option

  • Save CiprianSpiridon/5ab643e88c612a6caf9d4ce28d65c1c3 to your computer and use it in GitHub Desktop.

Select an option

Save CiprianSpiridon/5ab643e88c612a6caf9d4ce28d65c1c3 to your computer and use it in GitHub Desktop.
cart-simply-explained

Mumzworld Shopping Cart - How It Works

Overview

This document explains how the Mumzworld shopping cart works from a customer's perspective, including all the steps, processes, and business rules that make online shopping possible.

What is a Shopping Cart?

Think of the online shopping cart just like a physical shopping cart in a store:

  • Customers browse products and add items they want to buy
  • They can see what's in their cart and change quantities
  • They can remove items they don't want anymore
  • When ready, they proceed to checkout and pay

Customer Journey Flow

1. 🛍️ Browsing & Adding Items

Customer Journey:
Browse Products → Select Variant → Add to Cart → Continue Shopping
     ↓              ↓              ↓              ↓
   "I want        "I want the     "Put it in      "Let me look
    toys"         red, small      my cart"       for more"
                   version"

What happens behind the scenes:

  • System checks if product is available in customer's country
  • System checks if the specific color/size is in stock
  • System calculates price in customer's local currency
  • System adds item to customer's personal cart

2. 🛒 Managing Cart Contents

Cart Management Actions:
View Cart → Change Quantity → Remove Items → Apply Discounts
    ↓           ↓               ↓              ↓
"What's in   "I want 2        "I don't       "I have a
 my cart?"    instead of 1"    want this"     promo code"

What customers can do:

  • See all items in their cart
  • Change quantities (increase/decrease)
  • Remove items completely
  • Apply promotional codes
  • See total price with taxes

3. 💳 Checkout Process

Checkout Flow:
Review Cart → Enter Address → Choose Delivery → Enter Payment → Place Order
     ↓            ↓              ↓               ↓             ↓
  "Final       "Where to      "How fast      "How to        "Confirm
   check"       deliver?"      do I need      pay?"          purchase"
                                it?"

Detailed User Flows

Flow 1: Adding a Product to Cart

🎯 Goal: Customer wants to buy a Fisher-Price toy

Step 1: Browse Products
┌─────────────────────────────────┐
│ Customer searches "toys"        │
│ Sees list of available toys     │
│ Clicks on Fisher-Price toy      │
└─────────────────────────────────┘
                ↓
Step 2: Select Options
┌─────────────────────────────────┐
│ Customer sees product details   │
│ Chooses: Color = Red            │
│ Chooses: Size = Small           │
│ Sees price: 249.99 AED         │
└─────────────────────────────────┘
                ↓
Step 3: Add to Cart
┌─────────────────────────────────┐
│ Customer clicks "Add to Cart"   │
│ System checks stock             │
│ System adds to customer's cart  │
│ Shows confirmation message      │
└─────────────────────────────────┘
                ↓
Step 4: Continue or Checkout
┌─────────────────────────────────┐
│ Customer can:                   │
│ - Continue shopping             │
│ - View cart                     │
│ - Go to checkout                │
└─────────────────────────────────┘

Flow 2: Managing Cart Items

🎯 Goal: Customer wants to modify their cart

Step 1: View Cart
┌─────────────────────────────────┐
│ Customer clicks cart icon       │
│ Sees all items in cart:         │
│ - Fisher-Price Toy (Red, S)     │
│ - Educational Blocks (Blue, M)  │
│ - Total: 449.99 AED            │
└─────────────────────────────────┘
                ↓
Step 2: Make Changes
┌─────────────────────────────────┐
│ Customer actions:               │
│ - Change toy quantity to 2      │
│ - Remove blocks completely      │
│ - System recalculates total     │
│ - New total: 499.98 AED        │
└─────────────────────────────────┘
                ↓
Step 3: Apply Discounts
┌─────────────────────────────────┐
│ Customer enters promo code      │
│ "SAVE20" = 20% discount         │
│ System applies discount         │
│ Final total: 399.98 AED        │
└─────────────────────────────────┘

Flow 3: Checkout Process

🎯 Goal: Customer wants to complete their purchase

Step 1: Review Cart
┌─────────────────────────────────┐
│ Customer reviews final cart:    │
│ - Items: 2x Fisher-Price Toy    │
│ - Subtotal: 499.98 AED         │
│ - Discount: -100.00 AED        │
│ - VAT (5%): 20.00 AED          │
│ - Total: 419.98 AED            │
└─────────────────────────────────┘
                ↓
Step 2: Delivery Information
┌─────────────────────────────────┐
│ Customer enters:                │
│ - Delivery address              │
│ - Contact information           │
│ - Special delivery instructions │
└─────────────────────────────────┘
                ↓
Step 3: Delivery Options
┌─────────────────────────────────┐
│ Customer chooses:               │
│ □ Standard (2-3 days) - Free    │
│ ☑ Express (1 day) - 25 AED     │
│ □ Same Day - 50 AED            │
│ New total: 444.98 AED          │
└─────────────────────────────────┘
                ↓
Step 4: Payment
┌─────────────────────────────────┐
│ Customer chooses payment:       │
│ ☑ Credit Card                   │
│ □ Cash on Delivery              │
│ □ Digital Wallet                │
│ Enters card details             │
└─────────────────────────────────┘
                ↓
Step 5: Order Confirmation
┌─────────────────────────────────┐
│ System processes payment        │
│ Creates order #MW-2024-001234   │
│ Sends confirmation email        │
│ Shows order confirmation page   │
└─────────────────────────────────┘

Business Rules Explained

📍 Country-Specific Shopping

What it means: Customers only see products available in their country with local pricing.

Example:
UAE Customer sees:        Saudi Customer sees:
- Product: Available      - Product: Available  
- Price: 249.99 AED      - Price: 255.99 SAR
- VAT: 5%                - VAT: 15%
- Delivery: 1-2 days     - Delivery: 2-3 days

Egypt Customer sees:
- Product: Not Available
- Reason: Not shipped to Egypt

🎨 Variant Selection

What it means: Customers must choose specific options (color, size) and each combination has its own price and stock.

Example: Fisher-Price Toy
┌─────────────┬───────────┬─────────────┬──────────┐
│ Color/Size  │   Price   │    Stock    │ Available│
├─────────────┼───────────┼─────────────┼──────────┤
│ Red + Small │ 249.99    │ In Stock    │    ✅     │
│ Red + Large │ 299.99    │ In Stock    │    ✅     │
│ Blue + Small│ 249.99    │ Out of Stock│    ❌     │
│ Blue + Large│ 299.99    │ In Stock    │    ✅     │
└─────────────┴───────────┴─────────────┴──────────┘

🎁 Bundle Products

What it means: Customers can buy pre-made sets of products at a discount.

Example: Starter Kit Bundle
Individual Items:
- Toy 1: 249.99 AED
- Toy 2: 199.99 AED  
- Toy 3: 149.99 AED
Total if bought separately: 599.97 AED

Bundle Price: 499.99 AED
Savings: 99.98 AED (16.7% off)

⚠️ Bundle Rules:
- Must buy all items together
- Cannot change colors/sizes
- Cannot change quantities
- If any item is out of stock, entire bundle unavailable

🛒 Cart Persistence

What it means: Customer's cart is saved and remembered.

Cart Behavior:
┌─────────────────┬──────────────────────────────────┐
│   Scenario      │           What Happens           │
├─────────────────┼──────────────────────────────────┤
│ Logged in user  │ Cart saved to their account      │
│ Browse on phone │ Cart appears on laptop too       │
│ Close browser   │ Cart still there when return     │
│ Guest user      │ Cart saved for 30 days          │
│ Clear cookies   │ Guest cart is lost              │
└─────────────────┴──────────────────────────────────┘

🎫 Promotions & Discounts

What it means: The cart automatically finds and applies the best deals for customers.

How Promotions Work:

Promotion Flow:
Customer adds items → Cart asks Promotion Service → Best deals applied → Savings shown

Example Scenario:
1. Customer adds Fisher-Price toy (249.99 AED)
2. Cart asks: "Any promotions for this customer/product?"
3. Promotion Service responds: "20% off toys + Free delivery over 200 AED"
4. Cart applies: -50.00 AED discount + 0.00 AED delivery
5. Customer sees: "You saved 75.00 AED!"

Types of Promotions Applied:

┌─────────────────────┬─────────────────────────────────────┐
│   Promotion Type    │              How It Works           │
├─────────────────────┼─────────────────────────────────────┤
│ Percentage Discount │ 20% off all toys                   │
│ Fixed Amount Off    │ 50 AED off orders over 300 AED     │
│ Buy X Get Y         │ Buy 2 toys, get 1 free             │
│ Free Delivery       │ No delivery charges over 200 AED   │
│ Bundle Discounts    │ Extra 10% off when buying bundles  │
│ First-time Buyer    │ 15% off for new customers          │
│ Loyalty Rewards     │ VIP customers get 25% off          │
│ Seasonal Sales      │ Black Friday: 40% off everything   │
└─────────────────────┴─────────────────────────────────────┘

Promotion Priority System:

When multiple promotions apply:
1. Cart calculates all possible combinations
2. Promotion Service determines the best deal for customer
3. Cart applies the combination that saves the most money
4. Customer always gets maximum savings automatically

Example:
Available: 20% off toys + Free delivery over 200 AED
Available: 25% off orders over 400 AED
Cart total: 450 AED with toys

System chooses: 25% off entire order (saves 112.50 AED)
Instead of: 20% off toys only (saves 90.00 AED)

Promo Code Application:

Manual Promo Code Flow:
Customer enters "SAVE30" → Cart asks Promotion Service → Validates code → Applies if valid

Validation Checks:
✅ Code exists and is active
✅ Customer eligible (not used before if single-use)
✅ Cart meets minimum requirements
✅ Products are eligible for this promotion
✅ Code hasn't expired
✅ Usage limits not exceeded

Results:
✅ Valid: Discount applied + "Promo code applied successfully!"
❌ Invalid: Error message + "This code is not valid for your cart"

🚚 Delivery Promise Service

What it means: The cart shows accurate delivery dates and options based on real logistics data.

How Delivery Promises Work:

Delivery Promise Flow:
Cart items selected → Ask Delivery Service → Real-time calculations → Show accurate dates

Customer sees:
┌─────────────────────────────────────────────────────────────┐
│ 📦 Your Delivery Options:                                   │
│                                                             │
│ 🚚 Standard Delivery - FREE                                │
│    Arrives: Tuesday, Jan 23rd (2-3 business days)          │
│    All items delivered together                            │
│                                                             │
│ ⚡ Express Delivery - 25 AED                               │
│    Arrives: Monday, Jan 22nd (1 business day)              │
│    All items delivered together                            │
│                                                             │
│ 🏃 Same Day Delivery - 50 AED                              │
│    Arrives: Today by 8 PM                                  │
│    ⚠️ Blocks not available for same day                    │
└─────────────────────────────────────────────────────────────┘

Delivery Calculations Consider:

Factors affecting delivery promises:
┌─────────────────────┬─────────────────────────────────────┐
│      Factor         │            Impact                   │
├─────────────────────┼─────────────────────────────────────┤
│ Vendor Type         │ Direct vs Marketplace vs Partner   │
│ Vendor Location     │ Local vendor = faster delivery     │
│ Vendor Capabilities │ Same day support varies by vendor  │
│ Product Location    │ Vendor warehouse = shipping origin │
│ Customer Address    │ Dubai = same day, Fujairah = +1 day│
│ Item Size/Weight    │ Large items = different options    │
│ Stock Availability  │ In stock at vendor = immediate ship│
│ Delivery Capacity   │ Peak times = longer estimates      │
│ Weather/Holidays    │ Delays during Ramadan/sandstorms   │
│ Product Restrictions│ Fragile items = special handling   │
│ Vendor SLA          │ Each vendor has different promises │
└─────────────────────┴─────────────────────────────────────┘

Mixed Cart Scenarios:

When cart has items from different vendors and delivery promises:

Scenario 1: All items from same vendor (Mumzworld Direct)
Result: Single shipment with chosen delivery speed

Scenario 2: Items from different vendors
- Fisher-Price Toy (Vendor A) + Educational Blocks (Vendor B)
Result: 
- Standard: "2 separate deliveries, both arrive Jan 23-24"
- Express: "2 separate deliveries, both arrive Jan 22"
- Same day: "Available only if both vendors support same day"

Scenario 3: Mixed delivery promises per vendor
Customer chooses different speeds for different vendors:
- Vendor A items: Express delivery (arrives Jan 22)
- Vendor B items: Standard delivery (arrives Jan 24)
Result: "Your order will arrive in 2 shipments"

Scenario 4: Vendor limitations
- Vendor A: Supports all delivery options
- Vendor B: Only supports standard delivery
Result: 
- Customer must choose: "All standard" OR "Split delivery"
- If split: Vendor A express + Vendor B standard = 2 deliveries

Vendor-Based Delivery Splitting Rules:

Delivery Splitting Logic:

By Vendor:
┌─────────────────┬─────────────────────────────────────┐
│   Vendor Type   │            Delivery Behavior        │
├─────────────────┼─────────────────────────────────────┤
│ Mumzworld Direct│ All delivery options available      │
│ Local Partner   │ Standard + Express only             │
│ International   │ Standard only (7-10 days)          │
│ Marketplace     │ Vendor-specific delivery options   │
└─────────────────┴─────────────────────────────────────┘

By Delivery Promise:
Each vendor can have different delivery speeds in same cart:
- Vendor A: Same day delivery
- Vendor B: Express delivery  
- Vendor C: Standard delivery
= 3 separate shipments with different arrival dates

Customer Choice:
□ Fastest possible (may result in multiple shipments)
☑ Wait for all items (single delivery, slowest vendor speed)
□ Mix delivery speeds (multiple shipments, different costs)

Customer Experience:

Cart Display Shows:

📦 Your Cart - 3 items from 2 vendors

Vendor A (Mumzworld Direct):
- Fisher-Price Toy x1
- Delivery options: Same day (50 AED) | Express (25 AED) | Standard (Free)

Vendor B (Toy Paradise):  
- Educational Blocks x2
- Delivery options: Express (30 AED) | Standard (Free)
- ⚠️ Same day not available from this vendor

Customer Selects:
☑ Vendor A: Express delivery (arrives Jan 22)
☑ Vendor B: Standard delivery (arrives Jan 24) 

Result:
✉️ "Your order will arrive in 2 shipments"
📅 "First delivery: Monday, Jan 22"
📅 "Second delivery: Wednesday, Jan 24"
💰 "Total delivery cost: 25 AED"

Delivery Promise Updates:

Real-time Promise Updates:

At Cart View:
- Initial estimates based on current inventory

At Checkout:
- Refined estimates based on exact address
- Final confirmation of delivery dates

After Order:
- Real tracking with updated delivery windows
- Notifications if delays occur

Example:
Cart: "Arrives Tuesday"
Checkout: "Arrives Tuesday between 10 AM - 2 PM"  
After order: "Out for delivery, arrives by 1 PM today"

🔄 Service Integration Summary

How the Cart Communicates with Other Services:

Cart Service Integration Map:

                    🛒 CART SERVICE
                          │
          ┌───────────────┼───────────────┐
          │               │               │
          ▼               ▼               ▼
    
🏷️ PROMOTION         📦 DELIVERY        🏪 CATALOG
   SERVICE           PROMISE SERVICE      SERVICE
      │                    │               │
      ▼                    ▼               ▼
"What discounts      "When can this     "Is this product
 apply to this       cart be delivered   available and
 customer's cart?"   to this address?"   what's the price?"

Real-time Updates:
- Every cart change triggers new promotion check
- Address change triggers new delivery calculation  
- Product updates refresh from catalog service

Error Scenarios & Solutions

Common Issues Customers Face

1. Out of Stock During Shopping

Problem: Customer adds item to cart, but by checkout it's out of stock
Solution: 
- Show real-time stock warnings
- Suggest similar products
- Offer "notify when available" option

2. Price Changes

Problem: Price increases between adding to cart and checkout
Solution:
- Honor cart price for 24 hours
- Show clear price change notification
- Let customer decide to continue or remove

3. Delivery Restrictions

Problem: Customer's address cannot receive certain products
Solution:
- Check delivery restrictions early
- Show alternative delivery options
- Suggest pickup locations

4. Payment Failures

Problem: Customer's payment is declined
Solution:
- Keep cart intact
- Suggest different payment methods
- Provide clear error messages
- Offer customer support contact

Cart Data Examples

💾 What Information is Stored

Customer Cart Contains:
┌──────────────────────────────────────────────────────┐
│ Customer Information:                                │
│ - Customer ID: 12345                                 │
│ - Country: UAE                                       │
│ - Language: English                                  │
│ - Currency: AED                                      │
│                                                      │
│ Cart Items:                                          │
│ 1. Fisher-Price Toy                                  │
│    - SKU: TOY123-RED-S                              │
│    - Quantity: 2                                     │
│    - Unit Price: 249.99 AED                         │
│    - Total: 499.98 AED                              │
│                                                      │
│ 2. Educational Blocks                                │
│    - SKU: TOY456-BLUE-M                             │
│    - Quantity: 1                                     │
│    - Unit Price: 199.99 AED                         │
│    - Total: 199.99 AED                              │
│                                                      │
│ Cart Totals:                                         │
│ - Subtotal: 699.97 AED                              │
│ - Discount: -100.00 AED (SAVE20 code)               │
│ - VAT (5%): 30.00 AED                               │
│ - Delivery: 25.00 AED (Express)                     │
│ - Grand Total: 654.97 AED                           │
│                                                      │
│ Timestamps:                                          │
│ - Created: 2024-01-15 10:30 AM                      │
│ - Last Updated: 2024-01-15 11:45 AM                 │
│ - Expires: 2024-02-14 10:30 AM                      │
└──────────────────────────────────────────────────────┘

Success Metrics

📊 How We Measure Cart Performance

Key Performance Indicators (KPIs):

Cart Conversion Rate:
- How many people who add items actually buy them
- Target: 70% of carts should convert to orders

Cart Abandonment Rate:
- How many people leave without buying
- Target: Keep abandonment below 30%

Average Cart Value:
- How much money is in each cart
- Target: Increase over time through recommendations

Add-to-Cart Rate:
- How many product views result in cart additions
- Target: 15% of product views should add to cart

Cart Loading Speed:
- How fast the cart page loads
- Target: Under 2 seconds

Summary

The Mumzworld shopping cart is designed to provide a smooth, intuitive shopping experience that:

Makes shopping easy - Clear product options, simple add-to-cart process ✅ Builds confidence - Real-time stock, clear pricing, secure checkout
Saves time - Persistent carts, quick modifications, multiple payment options ✅ Prevents errors - Stock validation, price protection, clear error messages ✅ Increases sales - Bundle suggestions, promotional codes, delivery options

The cart acts as the bridge between product discovery and order completion, ensuring customers can easily and confidently purchase the products they want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment