Overview
The Ecom platform provides a comprehensive cart and checkout system that manages shopping sessions, calculates prices with taxes and shipping, applies coupons, and processes orders through a multi-step checkout flow.Guest & User Carts
Separate cart handling for guests and authenticated users
Dynamic Pricing
Real-time price calculations with discounts and taxes
Coupon System
Cart-based and product-based discount coupons
Multi-Step Checkout
Shipping info, delivery options, and payment selection
Cart Model
TheCart model stores temporary shopping cart data for users.
Cart Structure
~/workspace/source/app/Models/Cart.php:9-28
Cart Fields
User Identification
User Identification
- user_id: Authenticated user ID
- temp_user_id: Session-based ID for guest users
- owner_id: Seller/shop owner ID
Product Information
Product Information
- product_id: Reference to product
- variation: Product variant (color, size, etc.)
- quantity: Number of items
- product_referral_code: Affiliate tracking code
Pricing & Discounts
Pricing & Discounts
- price: Unit price after discounts
- tax: Tax amount
- shipping_cost: Shipping fee
- discount: Coupon discount amount
- coupon_code: Applied coupon code
- coupon_applied: Boolean flag
Shipping
Shipping
- address_id: Selected delivery address
Cart Management
TheCartController handles all cart operations.
Viewing Cart
~/workspace/source/app/Http/Controllers/CartController.php:16-39
Adding to Cart
~/workspace/source/app/Http/Controllers/CartController.php:53-122
Cart Validations
Minimum Quantity
Enforces product-specific minimum order quantities
Stock Availability
Prevents adding more items than available stock
Auction Products
Prevents mixing auction and regular products
Duplicate Prevention
Limits one auction product per cart
Removing from Cart
~/workspace/source/app/Http/Controllers/CartController.php:125-141
Updating Quantity
~/workspace/source/app/Http/Controllers/CartController.php:144-204
Checkout Process
TheCheckoutController manages the multi-step checkout flow.
Step 1: Shipping Information
~/workspace/source/app/Http/Controllers/CheckoutController.php:102-112
Step 2: Store Shipping Address
~/workspace/source/app/Http/Controllers/CheckoutController.php:114-145
Step 3: Store Delivery Information
~/workspace/source/app/Http/Controllers/CheckoutController.php:147-196
Step 4: Payment & Order Creation
~/workspace/source/app/Http/Controllers/CheckoutController.php:30-83
Coupon System
The checkout process supports multiple coupon types.Applying Coupons
~/workspace/source/app/Http/Controllers/CheckoutController.php:198-309
Coupon Types
Cart-Based
Discount on total cart value with minimum purchase requirement
Product-Based
Discount on specific products in the cart
Welcome Coupon
Special coupons for new users with expiry dates
Removing Coupons
~/workspace/source/app/Http/Controllers/CheckoutController.php:311-329
Checkout Features
Guest Checkout
Temporary cart for non-logged users
Cart Merging
Merge guest cart on login
Multiple Shipping
Home delivery, pickup points, carriers
Dynamic Pricing
Real-time tax and shipping calculation
Minimum Order
Configurable minimum order amount
Club Points
Loyalty points redemption
Order Confirmation
~/workspace/source/app/Http/Controllers/CheckoutController.php:353-368
Checkout Flow Summary
- Add to Cart - Select product variants and quantities
- View Cart - Review items, update quantities, apply coupons
- Shipping Info - Select or add delivery address
- Delivery Options - Choose shipping method (home/pickup/carrier)
- Payment Selection - Select payment gateway or manual payment
- Order Creation - Generate orders, reduce stock, apply discounts
- Payment Processing - Process payment through gateway
- Order Confirmation - Display order details and confirmation
Related Resources
Order Management
Learn how orders are processed after checkout
Product Management
Understand product variants and pricing