Home > @shopware-pwa/composables > useAddToCart

# useAddToCart variable

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.

Add product to cart. Options - IUseAddToCart


useAddToCart: (rootContext: ApplicationVueContext, product: Product) => IUseAddToCart

# Example

Example of possibilities:

const {isInCart, quantity, addToCart} = useAddToCart(root, product)
if (!isInCart.value) {
   quantity.value = 5
   await addToCart()