@vtex/buy-button

Component used to call a mutation that adds one item to the cart

Usage no npm install needed!

<script type="module">
  import vtexBuyButton from 'https://cdn.skypack.dev/@vtex/buy-button';
</script>

README

BuyButton

BuyButton is a canonical component that any VTEX store can install.

Disclaimer

This component still under construction. Everything may - and will - break. Use with caution, and avoid for now its use in Production projects.

Install

yarn add @vtex/buy-button
# or
npm install @vtex/buy-button

Configuration

/**
 * The quantity of products to be added to the cart
 */
- quantity
  - Type: Number

/**
 * The specification of which product will be added to the cart.
 */
- skuId
  - Type: Number

/**
 * Which seller is being referenced by the button.
 */
- seller
  - Type: String

/**
 * Sales channel.
 */
- salesChannel
  - Type: String

/**
 * Graphql property to call a mutation.
 */
- mutate
  - Type: Function

/**
 * Function that will be called after the mutation.
 */
- afterClick
  - Type: Function

/**
 * The user's cart id
 */
- orderFormId
  - Type: String