Add to cart
Renders an add to cart button.
import { render, AddToCartUI } from 'geta-checkout';
const options = {};
render('[data-add-to-cart]', AddToCartUI, options);
Options
| Name | Example |
|---|---|
| itemId | Apple |
| quantity | 1 |
| showIcon | true |
| text | Add to cart |
| showCounter | false |
Examples
Options can be passed as data attributes as well.
<!-- Render a button -->
<div data-add-to-cart='{"itemId": "1"}'></div>
<!-- Add several items to cart at once -->
<div data-add-to-cart='{"itemId": "1", "quantity": 3}'></div>
<!-- Add a text label -->
<div data-add-to-cart='{"itemId": "1", "text": "Add"}'></div>
<!-- Add a counter -->
<div data-add-to-cart='{"itemId": "1", "text": "Add", "showCounter": true}'></div>