Documentation Index
Fetch the complete documentation index at: https://mintlify.com/openshiporg/openfront/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TheupdateActiveCart mutation with line items allows you to add product variants to an existing cart. This is the second step in the checkout flow after creating a cart.
GraphQL Mutation
Parameters
The ID of the cart to add items to
The cart update data
Response
Cart identifier
Updated array of line items in the cart
Formatted cart subtotal (sum of all line items before tax and shipping)
Formatted cart total (subtotal + shipping + tax - discounts)
Example Request
Add Single Item
Add Multiple Items
Add Item with Metadata
Behavior
Price Calculation
When items are added to the cart:- The system finds the price for the product variant in the cart’s region
- Applies any active discounts that match discount conditions
- Calculates line item totals
- Updates cart subtotal and total with tax and shipping
Inventory Validation
The system validates:- Product variant exists and is active
- Sufficient inventory is available (if inventory tracking is enabled)
- Variant is available in the cart’s region
Duplicate Items
If you add a product variant that already exists in the cart, a new line item is created. To increase quantity of an existing item, use theupdate operation instead:
Automatic Calculations
Adding items triggers automatic recalculation of:- Line item totals
- Cart subtotal
- Discount amounts (if applicable)
- Tax amount based on region tax rate
- Cart total
Next Steps
After adding items to the cart:- Set or update shipping/billing addresses
- Apply discount codes (optional)
- Select shipping method
- Create payment sessions
- Complete the cart to create an order
Related
- Create Cart - Initialize a new cart
- Complete Cart - Convert cart to order
- Update Line Item Quantity - Modify existing line items
- Remove Line Item - Remove items from cart