Cart Management
Update Line Item
Updates the quantity of an existing line item in the shopping cart
PUT
Update Line Item
Overview
The Update Line Item endpoint modifies the quantity of an existing product in the cart. Key features include:- Quantity Modification: Update item quantities or remove items by setting quantity to 0
- Automatic Recalculation: All pricing and shipment information is automatically updated
- Shipment Preservation: Items remain in their assigned shipments after quantity updates
- Addon Adjustment: Addon offers may change based on new cart totals
Authentication
Device authentication token to identify and map the session
Path Parameters
Domain of the merchant website (e.g.,
staging.luma.gift)Unique identifier of the line item to update
Request Body
New quantity for the line item (minimum 0, set to 0 to remove the item)
Response
Returns the complete updated shopping cart. See Get Cart for full response schema.Update Behavior:
- Quantity > 0: Updates the item quantity and recalculates pricing
- Quantity = 0: Removes the item from the cart and its shipment
- Empty Shipments: Shipments with no remaining items are automatically removed
Code Examples
Example Scenarios
Increase Quantity
Update an item from quantity 1 to 2:Remove Item
Set quantity to 0 to remove an item:Error Responses
400 Bad Request
400 Bad Request
Invalid request format or parameters
404 Not Found
404 Not Found
Line item does not exist in the cart
422 Unprocessable Entity
422 Unprocessable Entity
Invalid quantity or processing error
Update Behavior
The Update Line Item endpoint maintains cart integrity:
- Shipment Assignment: Items remain in their assigned shipments after updates
- Empty Shipment Cleanup: Shipments with no items are automatically removed
- Addon Recalculation: Available addons may change based on new cart value
- Price Updates: All totals are recalculated including shipping and tax
Implementation Notes
The update operation preserves the cart structure:- Item Location: The item remains in its current shipment
- Shipment Options: Fulfillment and shipping options are preserved
- Addon State: Selected addons remain unless they become invalid
- Session Continuity: Cart session and authentication remain active
Related Endpoints
- Get Cart - View current cart state
- Add Line Item - Add new items to cart
- Clear Cart - Empty the entire cart
Update Line Item