Add to Cart Button
Smart purchase button — adapts to product type: physical → add-to-cart (variant-aware); digital one-time single → buy; digital one-time multiple → buys the plan picked via productPlans; subscription/service → shows subscribeLabel/contactLabel (display-only, matching the default product page). mode=cart adds to cart, buy-now redirects to /checkout. single_product only.
Type: "addToCartButton"
Smart purchase button — adapts to product type: physical → add-to-cart (variant-aware); digital one-time single → buy; digital one-time multiple → buys the plan picked via productPlans; subscription/service → shows subscribeLabel/contactLabel (display-only, matching the default product page). mode=cart adds to cart, buy-now redirects to /checkout. single_product only.
Catatan: Element template-only. Berlaku di template:
single_product.
Props
| Field | Type | Default | Keterangan |
|---|---|---|---|
label | string | "Add to Cart" | Label |
mode | 'cart'|'buy-now' | "cart" | Mode |
showIcon | boolean | true | Tampilkan ikon |
iconName | string | "ShoppingCart" | Nama ikon (Lucide) |
width | 'full'|'auto' | "full" | Lebar |
alignment | enum | "left" | Alignment (saat Auto) |
size | 'sm'|'md'|'lg' | "md" | Ukuran |
variant | 'primary'|'secondary'|'outline' | "primary" | Variant |
outOfStockLabel | string | "Stok Habis" | Label Stok Habis |
needsSelectionLabel | string | "Pilih Varian" | Label Belum Pilih Varian |
needsPlanLabel | string | "Pilih Paket" | Label Belum Pilih Paket (digital) |
subscribeLabel | string | "Mulai Langganan" | Label Langganan |
contactLabel | string | "Hubungi Kami" | Label Service/Booking |
Contoh
{
"id": "add01abc",
"type": "addToCartButton",
"props": {
"label": "Add to Cart",
"mode": "cart",
"showIcon": true,
"iconName": "ShoppingCart",
"width": "full",
"alignment": "left",
"size": "md",
"variant": "primary",
"outOfStockLabel": "Stok Habis",
"needsSelectionLabel": "Pilih Varian",
"needsPlanLabel": "Pilih Paket",
"subscribeLabel": "Mulai Langganan",
"contactLabel": "Hubungi Kami"
}
}