Buy Button

Description

BuyButton is a VTEX Component that is resposible to handle events of adding products in the minicart. This Component can be imported and used by any VTEX App.

📢 Disclaimer: Don't fork this project, use, contribute, or open issue with your feature request.

Table of Contents

Usage

You should follow the usage instruction in the main README.

Then, add buy-button block into your app theme, as we do in our Product Details app.

Blocks API

When implementing this component as a block, various inner blocks may be available. The following interface lists the available blocks within BuyButton and describes if they are required or optional.

1
2
3
  "buy-button": {
    "component": "BuyButton"
  }

For now this block does not have any required or optional blocks.

Configuration

Through the Storefront, you can change the BuyButton's behavior and interface. However, you also can make in your theme app, as Store theme does.

Prop nameTypeDescriptionDefault value
isOneClickBuyBooleanShould redirect to the checkout page or notfalse
shouldOpenMinicartBooleanShould open the Minicart after clicking the buttonfalse
largeBooleanSets button to large style, filling whole width (like a block)-
availableBooleanIf component is available or nottrue
showToastBooleanIf toast with feedback should be shown after add item request is processed-
showItemsPriceBooleanIf you want to show the total price of items to be added to cartfalse

Styles API

You should follow the Styles API instruction in the main README.

CSS Namespaces

🚧 🚧 🚧