Skip to main content

Interface: UseProductBundlesReturn

Defined in: composables/react/useProductBundles.ts:48

State and bundle actions returned by useProductBundles.

Properties​

addBundleToCart​

addBundleToCart: (bundleId, existingCartId?) => Promise<{ cart?: Cart; error?: string; success: boolean; }>

Defined in: composables/react/useProductBundles.ts:62

Adds a bundle to a (new or existing) cart.

Parameters​

bundleId​

number

existingCartId?​

string

Returns​

Promise<{ cart?: Cart; error?: string; success: boolean; }>


adding​

adding: boolean

Defined in: composables/react/useProductBundles.ts:54

true while a bundle is being added to the cart.


bundles​

bundles: UseProductBundlesBundleItem[]

Defined in: composables/react/useProductBundles.ts:50

The fetched bundles.


calcDiscountPercent​

calcDiscountPercent: (original, discounted) => number

Defined in: composables/react/useProductBundles.ts:64

Computes the rounded discount percentage between an original and discounted price.

Parameters​

original​

number

discounted​

number

Returns​

number


cartId​

cartId: string

Defined in: composables/react/useProductBundles.ts:58

Id of the cart bundles are added to.


error​

error: string | null

Defined in: composables/react/useProductBundles.ts:56

Last error message, or null.


fetchBundles​

fetchBundles: (productId) => Promise<void>

Defined in: composables/react/useProductBundles.ts:60

Fetches bundles that contain the given product.

Parameters​

productId​

number

Returns​

Promise<void>


loading​

loading: boolean

Defined in: composables/react/useProductBundles.ts:52

true while a bundle fetch is in flight.