Skip to content
Hekana Spray
Documentation
Getting started
Theme development
Components and tags

Localization

Apps and custom code

Examples and recipes
API reference
Publishing
Build apps
AI development

<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

html
<hk-add-to-cart />

Children: None. The tag is self-closing.

Props

Write props as kebab-case attributes.

PropTypeRequiredDefaultAllowed valuesEditor label
productdatano--Product
labeltextno--Button label
choose-labeltextno--Choose options label
sold-out-labeltextno--Sold out label
quantitybooleannotrue-Quantity picker
variantselectnosolidsolid, outlineButton 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:

html
<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 }}"
/>

Next steps