<hk-add-to-cart>
hk-add-to-cart: The add to cart button for a product, with quantity and sold-out states. Syntax, props, defaults and examples.
On this page
The add to cart button for a product, with quantity and sold-out states.
Group: Cart and checkout. Name in the editor: Add to cart. Complete props for every tag: Tag reference.
Syntax
<hk-add-to-cart />Children: None. The tag is self-closing.
Props
Write props as kebab-case attributes.
| Prop | Type | Required | Default | Allowed values | Editor label |
|---|---|---|---|---|---|
product | data | no | - | - | Product |
label | text | no | - | - | Button label |
choose-label | text | no | - | - | Choose options label |
sold-out-label | text | no | - | - | Sold out label |
quantity | boolean | no | true | - | Quantity picker |
variant | select | no | solid | solid, outline | Button style |
Required props
None. Every prop has a default or can be left out.
Examples
From packages/templates-default/theme/blocks/product-buy.snf, lines 1 to 7:
<hk-add-to-cart
product="{{ product }}"
label="{{ block.settings.label }}"
sold-out-label="{{ block.settings.sold_out_label }}"
quantity="{{ block.settings.show_quantity }}"
variant="{{ block.settings.button_style }}"
/>Related tags
hk-cart-count: Shows the number of items in the cart.hk-cart-items: Lists the cart's lines, customizable through named parts.hk-cart-summary: The cart subtotal and the checkout button.hk-cart-drawer: A slide-in cart panel that can open when an item is added.hk-inline-checkout: Embeds Hekana's checkout for one product inside the page.
