---
title: "Verify cart quantity changes update line and order totals"
description: "Increase and decrease a cart quantity, checking independent arithmetic, persisted quantity, and any quantity-based adjustment rules after each change."
canonical_url: "https://vostride.com/agent-library/shopping-cart/quantity-update-totals.md"
md_url: "https://vostride.com/agent-library/shopping-cart/quantity-update-totals.md"
content_kind: "recipe"
topic: "shopping-cart"
---

# Verify cart quantity changes update line and order totals

Increase and decrease a cart quantity, checking independent arithmetic, persisted quantity, and any quantity-based adjustment rules after each change.

## Risk

Quantity controls can update a badge while leaving totals or server state stale. The test uses a deliberately nonround unit price and explicit adjustment policy so arithmetic errors remain visible rather than disappearing under convenient fixture values.

## Fixtures

- A test product with sufficient stock and a known nonround unit price.
- A clean cart with documented tax-display and quantity-discount behavior.
- An independent total calculation fixture and a cart-state hook reporting persisted quantity and price components.

## Steps

1. Add one fixture unit and verify the initial quantity, unit price, line subtotal, and displayed cart total.
2. Increase quantity to three and verify the control settles at three with line arithmetic matching the independent expected result.
3. Inspect the cart-state hook and verify three is persisted; reload and verify the same quantity and amounts remain.
4. Reduce quantity to two and verify any quantity-tier adjustment is removed or retained according to the documented rule.
5. Inspect the final cart state and verify quantity two, the expected line subtotal, and a cart total whose components reconcile independently.

## Expected results

- Quantity changes update the stored cart line rather than only local controls.
- Line arithmetic and cart totals match the documented pricing rules at both quantities.
- Reload does not restore an earlier quantity or amount.

## False-pass traps

- A correct quantity input with an unchanged total is an incomplete update.
- Multiplying a discounted displayed unit price without understanding the pricing rule can create an incorrect expected total.

## Cleanup

- Clear the test cart and release any quantity reservations created by the application.

## Use with agent-qa

Adapt this test design to your application's acceptance criteria and configured target using the [recipe execution guide](/agent-library/software-factory/turn-a-recipe-into-an-agent-qa-test.md). External fixture setup and non-UI checks require your own supported hooks or test tooling. Validate the authored test, execute it, and inspect the completed evidence; this recipe is not a recorded test result.

## References

- [agent-qa test](/docs/agent-qa/configuration/test.md)
- [agent-qa hooks](/docs/agent-qa/guides/hooks.md)
- [agent-qa auth state](/docs/agent-qa/guides/auth-state.md)

- [Shopping cart QA recipes](/agent-library/shopping-cart.md)
- [Software factory QA library](/agent-library.md)
