AddToCartButton

Import
import AddToCartButton from 'react-storefront/AddToCartButton'

Props

NameTypeDefaultDescription
productobject

The product to add to the cart

cartURLstring'/cart'

The URL for the cart page. Defaults to '/cart'.

cartLinkTextstring'View My Cart'

The text for the cart link. Defaults to "View My Cart".

dockedboolfalse

Set to true to dock the button at the bottom of the viewport so that it is always visible

confirmationunion : string |
object

A message to display when an item is added to the cart. Could be a string or react component

snackbarPropsobject{}

Props to be applied to the Snackbar element in which the confirmation message is displayed.

CSS API

You can override all the class names injected by Moov-PWA thanks to the classes property. This property accepts the following keys:

  • root
  • docked
  • confirmation
  • cartLink