Home > widget-integration > CartService > changeQuantity

CartService.changeQuantity() method

Change quantity of a cart item with queue management Business logic method - ensures sequential updates to prevent conflicts

Signature:

changeQuantity(productId: string, quantity: number): Promise<unknown>;

Parameters

Parameter

Type

Description

productId

string

Product variant ID or cart line item ID

quantity

number

New quantity (0 to remove item)

Returns:

Promise<unknown>

Promise resolving to cart update response from Shopify API

Exceptions

{Error} When cart update fails or product ID is invalid