PRACTICAL GUIDE / test cases for shopping cart

Test Cases for Shopping Cart: E-commerce QA Examples

Test cases for shopping cart QA covering add, remove, quantity, coupons, totals, inventory, persistence, checkout handoff, and edge cases too.

By The Testing AcademyUpdated July 10, 20268 min read
All field guides
In this guide10 sections
  1. Define Cart Ownership and Price Policy
  2. Build Products That Expose Cart Rules
  3. Add, Combine, Update, and Remove Lines
  4. Recalculate Every Monetary Component
  5. Challenge Coupons and Promotion Interactions
  6. Handle Inventory and Price Changes Mid-Journey
  7. Test Persistence, Login Merge, and Isolation
  8. Prove the Checkout Handoff
  9. Check Accessibility and Responsive Interaction
  10. Build a Revenue-Focused Regression Suite

What you will learn

  • Define Cart Ownership and Price Policy
  • Build Products That Expose Cart Rules
  • Add, Combine, Update, and Remove Lines
  • Recalculate Every Monetary Component

A cart can show the right products and still produce the wrong order. A stale promotion, changed variant, rounded tax, or last inventory unit may alter the payable total between add-to-cart and checkout. If the interface silently trusts its earlier snapshot, the customer sees one price while the server charges another.

Test the cart as a server-validated commercial state, not merely a list in the browser. Every operation should preserve product identity, quantity rules, pricing explanations, ownership, and a safe handoff to checkout.

Define Cart Ownership and Price Policy

Record how anonymous carts are identified, how long they persist, whether they merge at login, and how many active carts an account may have. Define when price, tax, shipping, promotion, and inventory are calculated. A displayed amount might be a quote rather than a guarantee, but any later change must be explained before payment.

Clarify product identity. A line usually represents a sellable variant plus options, not only a product page. Size, color, subscription interval, seller, personalization, and fulfillment method may determine whether two additions merge or remain separate.

Contract areaDecision to capture
IdentityVariant and option fields that define one line
QuantityMinimum, maximum, increment, and stock policy
PriceSnapshot, dynamic recalculation, and rounding
OwnershipGuest cookie, account, tenant, and merge behavior
ExpiryCart, quote, reservation, and coupon lifetime

Build Products That Expose Cart Rules

Prepare an ordinary in-stock product, last-unit product, out-of-stock product, quantity-limited item, digital item, subscription, configurable variant, sale item, tax-exempt item, and product from another seller if the marketplace supports it. Include prices that exercise decimal rounding and a basket near free-shipping or discount thresholds.

Create coupons for fixed and percentage discounts, minimum spend, maximum discount, single use, account restriction, product restriction, date boundary, and incompatible combinations. Keep known shipping addresses for different tax and delivery zones.

Give every test cart and order a unique identifier. Restore product prices, inventory, coupon usage, and account limits after tests so parallel runs do not create false failures.

Add, Combine, Update, and Remove Lines

Add one item from listing, detail, search, recommendation, and quick-add surfaces that the product exposes. Verify variant, options, unit price, quantity, image, availability message, line total, cart count, and server cart. The same action from different entry points should create equivalent state.

Add the identical configuration twice and confirm the merge policy. Add the same product with another variant or personalization and confirm it stays separate. Rapidly double-click add, retry after a timeout, and add from two tabs. One intended action should not become an unexplained duplicate.

Change quantity to minimum, maximum, zero, negative, decimal, text, very large value, and just beyond stock or per-customer limit through both UI and direct request. If zero means remove, make that result clear. Remove the first, middle, and final line, undo removal if supported, and verify an empty cart has a useful next action.

Recalculate Every Monetary Component

After each line mutation, independently calculate item subtotal, line discounts, order discounts, shipping, tax, fees, credits, and final total. Assert the currency and precision as well as the number. The header cart preview, full cart, checkout, API, and eventual order should agree.

Test percentage rounding per line versus at order level, fixed discounts larger than a line, tax on discounted amounts, tax-inclusive prices, zero-decimal currencies where supported, and mixed tax categories. A one-cent difference needs a defined rule rather than a tolerance that hides the defect.

Change country, postal code, shipping method, or pickup option. Confirm affected totals recalculate and unaffected line data remains stable. Show progress during slow calculation and prevent checkout with a total whose validation is still pending.

Cross a free-shipping or service-fee threshold in both directions with quantity and coupon changes. The displayed qualification message, available delivery methods, and final shipping charge should update from the same authoritative subtotal.

Challenge Coupons and Promotion Interactions

Apply a valid code with original casing, different casing if allowed, surrounding spaces, and through paste. Then test invalid, expired, not-yet-active, exhausted, account-restricted, product-restricted, and minimum-spend failures. Error messages should preserve cart state and avoid revealing private campaign rules.

Cross the qualification boundary by adding and removing a small amount. The discount should appear and disappear consistently, with an explanation. If a promotion is automatically applied, show why it was added and whether a manual code can coexist.

Exercise stacking order among percentage, fixed, shipping, loyalty, and automatic promotions. Remove one of several promotions and recalculate from the undiscounted base according to policy. Reusing a single-use code across tabs or accounts should be decided atomically at checkout, not trusted because the cart accepted it earlier.

Handle Inventory and Price Changes Mid-Journey

Reduce stock after an item enters the cart. Open the cart, update quantity, and proceed to checkout. The customer should see which line changed and how to recover. A cart may not reserve stock, but checkout must never create negative inventory because an old page claimed availability.

Change price, sale status, seller, product title, or variant availability. Define which fields refresh and whether the customer must acknowledge a price increase. A lower price should also reconcile correctly rather than leaving a stale higher quote.

Race two customers for the last unit and two tabs from one customer. The inventory decision belongs on the server at the documented reservation or order boundary. If a reservation expires, release stock once and update the cart without deleting unrelated lines.

Test Persistence, Login Merge, and Isolation

Refresh, close and reopen the browser, restart the mobile app, clear only session storage, and return after the cart lifetime. Verify persistence matches the documented mechanism. Private or shared-device behavior should not expose another person's cart after logout.

Create a guest cart, then sign in with an existing account cart. Test disjoint items, identical variants, conflicting quantities, coupon differences, currency differences, and a line no longer available. The merge result should be deterministic and should not exceed limits or silently discard value.

Change account in the same browser and attempt to access a cart ID through the API. Ownership checks must prevent cross-user and cross-tenant reads or mutations. Cart tokens in URLs, logs, analytics, and referrers should not grant unintended access.

If the product supports save-for-later or wish-list movement, transfer a line in both directions with current quantity and variant intact. The saved list should not reserve inventory or preserve an expired commercial price unless promised. Moving the same item back twice must follow the normal merge and limit rules.

Prove the Checkout Handoff

Start checkout with a valid cart and compare every line and total with the server-created checkout or order draft. Modify the cart in another tab, then continue. The system should revalidate or freeze state according to policy and explain conflicts before payment.

Use browser back from address, shipping, and payment steps. Avoid creating a second cart or losing a reserved one. Complete an order and verify the cart clears or archives exactly once. Refresh the success page and retry callbacks without creating duplicate orders.

Test checkout service timeout after it accepted the cart. Reconcile by cart or checkout reference before allowing another transition. Failed payment should preserve recoverable lines while respecting price, promotion, and inventory changes that occurred in the meantime.

Check Accessibility and Responsive Interaction

Navigate line controls, coupon input, totals, and checkout action by keyboard and screen reader. Quantity controls need names that include the product, and changing or removing a line should announce the result and new total without moving focus to the top.

At high zoom and narrow widths, long titles, variants, prices, errors, and promotion text must remain associated with the correct line. Do not rely only on strikethrough or color to explain discounts and stock warnings. Touch targets should not cause accidental removal beside quantity changes.

Explore slow loading, image failure, translated labels, right-to-left layout, and a cart with many lines. Sticky totals or checkout controls must not cover the final product or validation message.

Build a Revenue-Focused Regression Suite

Automate ordinary add-update-remove, identical and distinct variants, monetary recalculation, promotion boundaries, guest-to-user merge, inventory change, unauthorized cart access, and checkout handoff. Seed catalog and promotion data through stable APIs so cases do not depend on a shared storefront state.

Keep one concurrent last-unit case and one lost-response checkout case in integration coverage. Use visual and accessibility review for dense carts, long translations, and responsive controls.

Use a commercial-journey scenario to connect the cart's separate risks. Take one basket through a price change, coupon application, login merge, inventory validation, payment, and order creation. Compare identifiers, quantities, and totals at each boundary. The scenario proves the cart preserves a coherent purchase agreement instead of merely retaining products on a page.

// FIELD DISPATCH

Get the QA Field Notes

Weekly QA battles, AI testing guides, and interview drills. Free on Substack.

The Testing Academy editorial desk

Practical QA guidance built around test evidence, production tradeoffs, and interview-ready explanations.

Published July 10, 2026 / Reviewed July 10, 2026

PRIMARY REFERENCES

Verify the details at the source

QABattle guides are practical explanations. Product behavior, standards, and APIs can change, so use these primary references for the canonical details.

  1. 01
    ISTQB glossary

    ISTQB

    Shared testing terminology for test design, defects, levels, and lifecycle concepts.

FAQ / QUICK ANSWERS

Questions testers ask

How should guest and account carts merge after login?

Apply a deterministic rule to disjoint items, identical variants, conflicting quantities, coupons, currencies, and unavailable lines. The merge must preserve product identity, respect stock and account limits, and explain discarded or changed value. It must also prevent another account in the same browser from reading or mutating either cart.

What should happen when a product price changes while it is in the cart?

Recalculate from the authoritative server policy and explain the difference before payment, especially for an increase. Verify line price, discounts, tax, shipping, fees, header preview, checkout, and order all agree. A decrease must also replace the stale quote, and checkout should remain disabled while recalculation is pending.

Where should the winner of the last inventory unit be decided?

At the documented server-side reservation or order boundary, never from the cart page's earlier availability snapshot. Race two customers and two tabs, then prove one valid outcome, no negative inventory, and one-time release after reservation expiry. The losing cart should identify the affected line without deleting unrelated items.

How should a checkout timeout after server acceptance be recovered?

Reconcile using the stable cart or checkout reference before allowing another transition. Browser back, refresh, and repeated callbacks must not create a second order or abandon a valid reservation. If payment failed, retain recoverable lines but revalidate any price, promotion, coupon usage, or inventory change that occurred during the attempt.

Which promotion interactions need atomic validation at checkout?

Single-use codes, minimum-spend boundaries, incompatible combinations, and concurrent use across tabs or accounts cannot rely on the cart's earlier acceptance. Recalculate stacking order among percentage, fixed, shipping, loyalty, and automatic offers from the defined base. Removing one promotion must produce a fully explained total without exposing private campaign rules.