---
title: "Verify adding a selected product variant creates the correct cart line"
description: "Choose a specific size and color, add it to a test cart, and verify variant identity, price, imagery, and persistence instead of relying on product title alone."
canonical_url: "https://vostride.com/agent-library/shopping-cart/add-variant-correct-line.md"
md_url: "https://vostride.com/agent-library/shopping-cart/add-variant-correct-line.md"
content_kind: "recipe"
topic: "shopping-cart"
---

# Verify adding a selected product variant creates the correct cart line

Choose a specific size and color, add it to a test cart, and verify variant identity, price, imagery, and persistence instead of relying on product title alone.

## Risk

A cart may add the product default variant even when the detail page shows another selection. Distinct SKU identifiers, prices, and option labels make this visible and prevent a generic product name from acting as a weak oracle.

## Fixtures

- A sandbox product with at least two purchasable variants whose option labels and SKU identifiers differ.
- A clean test-owned cart and independently known prices for the selected and default variants.
- A cart inspection hook reporting line variant identifier, quantity, and stored unit price.

## Steps

1. Open the fixture product and select the nondefault size and color; verify the selected controls, availability, and displayed unit price.
2. Add one item to the cart and verify the acknowledgement identifies the chosen options.
3. Open the cart and verify the product title, variant labels, SKU where displayed, quantity one, and selected-variant price.
4. Reload the cart and reopen its product link; verify the cart line persists and the product view resolves the chosen variant according to the link contract.
5. Inspect the cart hook and verify its stored variant identifier matches the selected fixture, with no default-variant line added.

## Expected results

- The cart contains exactly the selected variant at its expected price.
- Quantity and option labels remain correct after reload.
- No unintended default variant or duplicate line is stored.

## False-pass traps

- The same product title appears on every variant and cannot establish correct selection.
- A changing hero image is presentation evidence, not proof of the SKU committed to the cart.

## Cleanup

- Clear the run-owned cart and restore any fixture stock reservations.

## 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)
