Skip to main content

AddToCartButton

Adds products to Shop's cart with checkmark animation feedback. Users can continue shopping and add more items before checkout. Use this for browsing experiences where customers might want multiple products. For immediate single-product purchases, use BuyNowButton instead.

string
required

The GID of the product variant. E.g. gid://shopify/ProductVariant/456

string

CSS class name

boolean

Whether the button is disabled

string[]

The discount codes to apply to the cart

The product to add to the cart

'default' | 'sm' | 'lg'

Button size variant

Examples
import * as React from 'react'
import {AddToCartButton, useProduct} from '@shopify/shop-minis-react'

export default function MyComponent() {
const {product, loading} = useProduct({
id: 'gid://shopify/Product/7234590834753',
})

if (loading || !product) {
return null
}

return (
<AddToCartButton
product={product}
productVariantId={product.defaultVariantId}
/>
)
}

Preview

Was this page helpful?