Cart and Checkout: Quote-Based B2B Flow

This article explains our cart and checkout system designed for B2B quote-based sales.

The Problem: B2B vs B2C

Traditional e-commerce is B2C (Business-to-Consumer):

  • Fixed prices

  • Instant checkout

  • Credit card payment

  • Automated fulfillment

Our business is B2B (Business-to-Business):

  • Quote-based pricing

  • Manual review

  • Bank transfer payment

  • Custom configurations

We need a cart system that supports both models.

Cart Types

Quote Cart (Default)

Purpose: Request quote for custom configuration

Flow: Add items → Fill details → Submit → Receive quote via email

Payment: Not required upfront

Use case: Custom builds, bulk orders, negotiated pricing

Shopping Cart (Google Shopping)

Purpose: Direct purchase with fixed pricing

Flow: Add items → Fill details → Pay online → Order confirmed

Payment: Required upfront (Razorpay)

Use case: Standard configurations from Google Shopping

Detection: gclid, gbraid, or wbraid in URL

Cart Structure

Cart Model

Fields:

  • Items: List of line items (SKU, quantity, rate, amount)

  • CustomerName: Buyer name

  • CustomerEmail: Buyer email

  • CustomerPhone: Buyer phone

  • CustomerAddress: Shipping address

  • CustomerGSTIN: Tax ID (optional)

  • TotalAmount: Sum of line items

  • GSTAmount: Tax amount

  • NetAmount: Total + GST

  • Currency: Cart currency (INR, USD, etc.)

  • Type: "cart" or "quote"

Line Item

Fields:

  • SKU: Product identifier

  • quantity: Number of units

  • Rate: Price per unit

  • Amount: Rate × quantity

Add to Cart Flow

Direct Add (GET)

Add item via URL parameter with SKU.

Behavior:

  1. Create new cart or load existing
  2. Add SKU with quantity 1
  3. Show cart page

Use case: "Add to Cart" button on product page

Form Add (POST)

Form data: SKU, quantity, customer details

Behavior:

  1. Validate SKU exists
  2. Add to cart with specified quantity
  3. Update cart totals
  4. Show cart page

V-SKU Special Handling

V-SKUs (virtual/configured products) replace cart contents:

Reason: V-SKUs are complete systems, not compatible with other items

Behavior: Clear existing items, add only V-SKU

Exception: Google Shopping mode (allow multiple items)

Cart Storage

Location: Server-side Flask session

Format: Dictionary serialized to session

Persistence: Until browser close or cookie expiry

Benefit: No database writes until checkout

Checkout Flow

Quote Request

Steps:

  1. User fills customer details
  2. Clicks "Get a Quote"
  3. Cart saved to CRM ticket
  4. Email sent to sales team
  5. Sales team responds with quote

No payment: Quote sent via email

Direct Purchase

Steps:

  1. User fills customer details
  2. Clicks "Proceed to Payment"
  3. Cart saved to Order table
  4. Razorpay payment page shown
  5. Payment captured
  6. Order confirmed

Payment required: Razorpay integration

Currency Handling

Cart currency: Set when cart created

Locked: Cannot change currency after items added

Conversion: All items converted to cart currency

Display: Shows both cart currency and INR equivalent

GST Calculation

India (GSTIN provided): GST added at applicable rate

India (no GSTIN): GST added at applicable rate

International: No GST

Formula: Net amount = Total amount + GST

Tracking Parameters

When cart created, we store:

Campaign params: utm_source, utm_medium, utm_campaign

Click IDs: gclid, gbraid, wbraid, fbclid

Storage: Cookie-based with time window(30-minute)

Purpose: Attribute offline conversions to online campaigns via contact tracking

Email Notifications

Quote Request Email

To: Sales team

Content: Customer details, line items, total amount

Attachments: None

Order Confirmation Email

To: Customer

Content: Order details, payment info, next steps

Attachments: Invoice PDF (if payment received)

Payment Integration

Gateway: Razorpay

Supported: INR, USD, EUR, GBP

Methods: Credit card, debit card, UPI, net banking

Webhook: Payment status updates via webhook

See: Payment integration for details

Cart Validation

Before checkout:

SKU validation: All SKUs must exist

Quantity validation: Positive integers only

Customer validation: Name, email, phone required

Address validation: Required for shipping

GSTIN validation: Format check if provided

References

Related Articles

Summary

Our cart system supports both quote-based and direct purchase flows:

Cart types:

  • Quote cart (default, no payment)

  • Shopping cart (Google Shopping, payment required)

Features:

  • Multi-item cart

  • Currency locking

  • GST calculation

  • V-SKU special handling

  • Campaign tracking

Checkout:

  • Quote request (email to sales)

  • Direct purchase (Razorpay payment)

Storage:

  • Session-based (no DB until checkout)

  • 30-day persistence

This hybrid approach serves both B2B quote-based and B2C direct purchase models.


← Back to Documentation Index