Home > widget-integration > CartAPI

CartAPI class

Signature:

export declare class CartAPI extends BoostAPI 

Extends: BoostAPI

Constructors

Constructor

Modifiers

Description

(constructor)(platformLoader, appService)

Constructs a new instance of the CartAPI class

Methods

Method

Modifiers

Description

add(id, quantity, sellingPlanId, properties)

Add single product to cart

addMultiProductToCart(data)

Add multiple products to cart in a single request

change(id, quantity, retryCount)

Change cart item quantity with automatic retry on conflicts Uses exponential backoff strategy for 409 Conflict errors

clearCart()

Clear all items from cart

getAll()

Get all cart data from Shopify

getProductsInCart()

Get array of items currently in cart

getRequestHeaders()

protected

Get request headers for cart API calls Override to add custom headers (tracking, authentication, etc.)

getRetryConfig()

protected

Get retry configuration for cart API operations Override to customize retry behavior for high-traffic shops

processItemProperties(properties, sellingPlanId)

protected

Process item properties before adding to cart Override to add shop-specific properties or modify default behavior