Skip to main content
cartService lets you read and change the cart. Use it when your extension needs to inspect cart items, add an item, update quantities, or remove an item.

Global Name

API

Methods

getCartItemsCount

Returns the number of line items in the cart.

getLineItems

Returns the current cart line items.
Line items can include:
See Data models for the complete product and variant shapes.

addLineItem

Adds a product variant to the cart.
Returns true when the item was added.

updateLineItem

Updates the quantity of a line item.

removeLineItem

Removes a line item from the cart.