This page is about version 2.52.3 of the app, which is not the most recent version. The latest stable version is 2.90.0.
Description
ProductSummaryBuyButton
is a VTEX Component that renders the buy button.
This Component can be imported and used by any VTEX App.
:loudspeaker: 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 product-summary-buy-button
block into your app theme, as we do in our Product Summary app.
Blocks API
This component has an interface that describes which rules must be implemented by a block when you want to use the ProductSummaryBuyButton
.
_10 "product-summary-buy-button": {_10 "component": "ProductSummaryBuyButton"_10 }
Configuration
Through the Storefront, you can change the ProductSummaryBuyButton
's behavior and interface. However, you also can make in your theme app.
Prop name | Type | Description | Default value |
---|---|---|---|
isOneClickBuy | Boolean | Should redirect to checkout after clicking on buy | false |
buyButtonText | String | Custom buy button text | |
displayBuyButton | Enum | Set display mode of buy button (displayButtonAlways, displayButtonHover, displayButtonNone) | displayButtonAlways |
customToastURL | String | Set the link associated with the Toast created when adding an item to your cart. | /checkout/#/cart |
buyButtonBehavior | Enum | What the buy button should do when you click it, if you pass default it will add to cart only if there is only one SKU of that product (default, alwaysGoToProduct) | default |
Styles API
This app provides some CSS classes as an API for style customization.
To use this CSS API, you must add the styles
builder and create an app styling CSS file.
- Add the
styles
builder to yourmanifest.json
:
_10 "builders": {_10 "styles": "1.x"_10 }
- Create a file called
vtex.product-summary.css
inside thestyles/css
folder. Add your custom styles:
_10.buyButtonContainer {_10 margin-top: 10px;_10}
CSS Handles
CSS Handles | Description | Component Source |
---|---|---|
buyButtonContainer | The main container of buy button | index |
buyButton | Class right before buy button | index |
isHidden | Class when button is hidden | index |