Cart Item
Storefront Cart Item API endpoints
An API call to add cart item.
Path parameters
cart_idRequiredstringCart ID
Request body
product_idoptionalintegerquantityoptionalintegeraddonoptionalbooleanDefaults to false.
addon_durationoptionalintegerDefaults to 0.
bundleoptionalBundleBodyApplicable only for bundle product
gift_cardoptionalobjectApplicable only for gift card product
metadataoptionalobject[] | nullList of metadata and their values
optionsoptionalobject[]Applicable only for subscription product
ReturnsCart
Cart object response
Error responses
400objectThe product is a configurable bundle and the shop plan does not include configurable bundles (configurable_bundle_access_denied); the product has an onboarding template survey and the shop plan does not include onboarding templates (onboarding_templates_access_denied); the signed-in customer does not own the cart (unauthorized_customer); the cart is not active (it is completed or expired) or belongs to another shop (bad_request); or the product, a bundle item or a survey answer is out of stock (out_of_stock).
404objectNo cart with this ID exists.
422objectA body field fails validation. product_id is not a published, unarchived variant of this shop. quantity is below 1, or above 1 for a subscription when the shop has no quantity selector. addon or addon_duration is set for a product that cannot be an add-on or a cart with no subscription ('The addon is prohibited'). bundle is sent for a product that is not a configurable bundle, or misses preferences or items. bundle.preferences do not match the bundle ('The bundle.preferences is invalid.'). bundle.items hold a product the bundle does not allow ('The bundle.items contains the invalid product.'). options do not answer the product survey ('The options are invalid'). gift_card is sent for a one-time product that is not a gift card, or its email or name is missing. metadata holds unknown attributes or invalid values. expand is not an array.
An api call to update cart item
Path parameters
cart_idRequiredstringCart ID
cart_item_idRequiredstringCart Item ID
Request body
quantityoptionalintegeraddonoptionalbooleanDefaults to false.
addon_durationoptionalintegerDefaults to 0.
bundleoptionalBundleBodyApplicable only for bundle product
gift_cardoptionalobjectApplicable only for gift card product
metadataoptionalobject[] | nullList of metadata and their values
optionsoptionalobject[]Applicable only for subscription product
ReturnsCart
Cart object response
Error responses
400objectThe signed-in customer does not own the cart (unauthorized_customer); the item belongs to another cart, or the cart is not active (it is completed or expired) or belongs to another shop (bad_request); or the new quantity, a bundle item or a survey answer is out of stock (out_of_stock).
404objectNo cart or cart item with this ID exists.
422objectA body field fails validation. quantity is below 1, above 1 for a subscription when the shop has no quantity selector, or sent for an item added from a funnel offer. addon or addon_duration is set for a product that cannot be an add-on or a cart with no subscription ('The addon is prohibited'). bundle is sent for an item that is not a configurable bundle, or misses preferences or items. bundle.preferences do not match the bundle ('The bundle.preferences is invalid.'). bundle.items hold a product the bundle does not allow ('The bundle.items contains the invalid product.'). options do not answer the product survey ('The options are invalid'). gift_card is sent for a one-time product that is not a gift card. metadata holds unknown attributes or invalid values. expand is not an array.
An API call to delete cart item
Path parameters
cart_idRequiredstringCart ID
cart_item_idRequiredstringCart Item ID
ReturnsCart
Cart object response
Error responses
400objectThe signed-in customer does not own the cart (unauthorized_customer), or the item belongs to another cart, or the cart is not active (it is completed or expired) or belongs to another shop (bad_request).
404objectNo cart or cart item with this ID exists.
422objectThe expand query parameter is not an array.