cart/line/update
Update existing line items in the cart
Fields
LineItems Fields
id
• [ string ]required
id
• [ string ]requiredThe Shopify ID of the variant to add
variantId
• [ string ]
variantId
• [ string ]The Shopify ID of the variant to add
quantity
• [ number ]
quantity
• [ number ]Quantity of variants associated with the line item
sellingPlanId
• [ string ]
sellingPlanId
• [ string ]The Shopify Selling Plan ID for adding a subscription to cart
attributes
• [ array ]
attributes
• [ array ]An array of Key Value objects that store additional information to the lineItem
Updates existing line items in the cart by modifying their quantity, variant, attributes, or selling plan. This action supports partial updates - only the fields you provide will be changed, while other properties remain unchanged.
Basic usage - Updating the quantity of a line item
Tapcart.action("cart/lineItem/update", {
lineItems: [
{
id: "gid://shopify/CartLine/123456789",
quantity: 3
}
]
});
Basic usage - Updating lineItem attributes
Tapcart.action("cart/lineItem/update", {
lineItems: [
{
id: "gid://shopify/CartLine/123456789",
attributes: [
{
key: "color_preference",
value: "blue"
}
]
}
]
});
Advanced Usage - Updating multiple lineItems with various updates
Tapcart.action("cart/lineItem/update", {
lineItems: [
{
id: "gid://shopify/CartLine/123456789",
quantity: 2,
attributes: [
{
key: "color_preference",
value: "blue"
}
]
},
{
id: "gid://shopify/CartLine/987654321",
variantId: "gid://shopify/ProductVariant/11111",
sellingPlanId: "gid://shopify/SellingPlan/22222"
}
]
});
Updated 9 days ago