# 07-user-flow.md

# User Flow Document (Guest Checkout eCommerce System)

**Version:** 1.0
**Project Type:** Single Vendor eCommerce
**Framework:** Laravel
**Customer Model:** NO ACCOUNT (Guest Checkout Only)

---

## 1. PURPOSE OF THIS DOCUMENT

This file defines:

- Full customer journey
- Frontend user interaction flow
- Order placement logic
- Admin interaction dependency
- Conversion optimization flow

**Goal:** Make checkout as **FAST + SIMPLE + HIGH CONVERSION** as possible.

---

## 2. CORE PRINCIPLE _(IMPORTANT)_

### NO USER REGISTRATION

- No signup
- No login
- No password
- No user dashboard required

**Instead:** Customer is identified by:

- Phone number
- Order invoice ID

---

## 3. COMPLETE CUSTOMER JOURNEY FLOW

### 3.1 Entry Points

User can enter from:

- Facebook ads
- Google search
- Direct link
- Product sharing link
- Homepage

**Flow:**

```
Visitor → Website Landing Page
```

---

### 3.2 Product Discovery Flow

**User actions:**

1. Visits homepage
2. Browses categories
3. Uses search bar
4. Opens product page

**Decision point:**

- Interested → Product details page
- Not interested → Leave site

---

### 3.3 Product View Flow

**On Product Page, user sees:**

- Product images
- Price
- Discount
- Stock status
- Description
- Variants (if any)

**User actions:**

- Add to cart
- Buy now
- Continue browsing

---

### 3.4 Cart Flow

**Cart Actions:**

- Add product
- Update quantity
- Remove product
- Apply coupon

**System calculates:**

- Subtotal
- Discount
- Shipping charge
- Total

**Decision:** Proceed to checkout

---

### 3.5 Checkout Flow _(CRITICAL FLOW)_

#### Step 1: Customer Information

User fills:

- Full Name
- Phone Number
- Alternate Phone (optional)
- Full Address
- Area / Zone
- City

---

#### Step 2: Order Summary

System shows:

- Products list
- Quantity
- Price breakdown
- Discount applied
- Shipping cost
- Total amount

---

#### Step 3: Payment Selection

Options:

- Cash on Delivery **(DEFAULT)**
- Online payment (future expansion)

---

#### Step 4: Confirm Order

User clicks **"Place Order"**

System triggers:

- Order creation
- Invoice generation
- Stock reduction
- Notification system

---

### 3.6 ORDER SUCCESS FLOW

**After order placed, user sees:**

- Thank you page
- Invoice number
- Order summary
- Track order option

**System sends:**

- SMS confirmation (optional)
- Admin notification

---

### 3.7 ORDER TRACKING FLOW

User can track order using:

- Phone number **OR**
- Invoice ID

**Tracking steps:**

1. Enter phone or invoice
2. System fetches order
3. Show status timeline

**Statuses:**

| Status      | Meaning                  |
|-------------|--------------------------|
| New         | Just placed              |
| Confirmed   | Admin verified           |
| Packed      | Ready for shipment       |
| Shipped     | Courier picked           |
| Delivered   | Completed                |
| Cancelled   | Order cancelled          |
| Returned    | Product returned         |

---

## 4. RETURNING CUSTOMER FLOW (WITHOUT ACCOUNT)

Since no login system, the system uses **phone number recognition**:

### If phone exists:

- Show previous orders
- Suggest reorder option
- Identify VIP customer

### If new phone:

- Treat as new customer

---

## 5. ABANDONED CART FLOW

### Scenario:

User adds product → leaves without checkout

**System tracks:**

- Session ID
- IP address
- Phone (if entered)

### Actions:

- Save cart data
- Optional reminder (SMS/WhatsApp)
- Admin analytics visibility

---

## 6. ADMIN SIDE FLOW IMPACT

Every user action impacts admin system.

### When order is placed:

**Triggers:**

- Order appears in admin panel
- Stock decreases
- Profit calculation starts
- Courier option becomes available

---

## 7. ORDER STATUS FLOW (BUSINESS PIPELINE)

```
NEW → CONFIRMED → PACKED → SHIPPED → DELIVERED
                ↘ CANCELLED
                ↘ RETURNED
```

| Status    | Meaning               |
|-----------|-----------------------|
| NEW       | Just placed           |
| CONFIRMED | Admin verified        |
| PACKED    | Ready for shipment    |
| SHIPPED   | Courier picked        |
| DELIVERED | Completed             |

---

## 8. COURIER FLOW

After confirmation, admin action:

1. Select courier
2. Send order API
3. Get tracking ID
4. Assign shipment

**System updates:**

- `tracking_code` saved
- Shipment status updated

---

## 9. PAYMENT FLOW

### COD System (Default)

```
Order placed → Delivered → Cash collected → Admin marks paid
```

### Future Online Payment

```
Order placed → Payment gateway → Paid → Confirm order
```

---

## 10. CUSTOMER BEHAVIOR FLOW OPTIMIZATION

**Conversion Optimizations:**

- Sticky "Buy Now" button
- Countdown timer
- Low stock warning
- Free delivery banner
- COD badge

---

## 11. MOBILE USER FLOW _(IMPORTANT)_

Since majority users are mobile, flow is optimized for:

- One-click buy
- Fast checkout form
- Auto-fill address (future)
- WhatsApp contact button

---

## 12. ERROR HANDLING FLOW

**Possible issues:**

- Invalid phone
- Empty address
- Out of stock
- Payment failure

**System behavior:**

- Show validation error
- Prevent order creation
- Keep cart safe

---

## 13. DATA FLOW SUMMARY

```
Frontend → Cart → Checkout → Order → Admin Panel → Courier → Delivery → Profit Report
```

---

## 14. PERFORMANCE FLOW

To ensure speed:

- Cart stored in session
- Product cached
- Checkout optimized query
- Async job for SMS/email
- Lazy load product images

---

## 15. FINAL GOAL

This user flow ensures:

- ✅ Maximum conversion rate
- ✅ Minimum friction checkout
- ✅ Fast mobile experience
- ✅ Clean backend processing
- ✅ Scalable order system
