Home > @shopware-pwa/composables > IUseAddToCart

# IUseAddToCart interface

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

interface for useAddToCart() composable

Signature:

export interface IUseAddToCart 

# Properties

Property Type Description
addToCart () => Promise<void> (BETA) Add to cart method
error Ref<string> (BETA) Error message when adding to cart was not successful
getAvailableStock Ref<number | null> (BETA) Returns product count in available stock
getStock Ref<number | null> (BETA) Returns product count in stock
isInCart Ref<boolean> (BETA) Flag if product is already in cart
loading Ref<boolean> (BETA) Adding to cart is in progress
onAddToCart (fn: (params: { product: Product; quantity: Number; }) => void) => void (BETA) React on product added to cart
quantity Ref<number> (BETA) If you want to add more that 1 product set quantity before invoking addToCart