basket
object contains all information about the customer’s shopping cart. It’s available globally across all pages, making it perfect for cart widgets, mini-carts, and checkout processes.
Usage: Available globally - use anywhere to display cart contents, totals, and checkout links
Basic Cart Information
Access the essential cart data for displaying cart status and totals:Available Properties
Property | Type | Description |
---|---|---|
basket.isEmpty | Boolean | Check if cart is empty |
basket.items_count | Number | Number of items in cart |
basket.total_amount | String | Total amount for items in cart |
basket.items | Array | Object containing all products in cart |
Cart Items
Loop through cart items to display detailed cart contents:Cart Item Properties
When looping throughbasket.items
, each item has these properties:
Property | Type | Description |
---|---|---|
item.id | String | Product ID |
item.sku | String | Product article number |
item.url | String | Product link address |
item.title | String | Product title |
item.firstimage | String | Product image |
is_variant | Boolean | True if it’s a product variant |
variant_name | String | Variant designation |
item.price | String | Product unit price |
qty | Number | Quantity of product added to cart |
amount | String | Product total amount (unit price x quantity) |
Checkout Integration
Paylink Usage
Thepaylink
provides the correct checkout URL when the cart is not empty:
Mini Cart Examples
Slide-out Cart
Cart Page Template
Mobile Cart Examples
Mobile Cart Badge
Best Practices
Empty State Handling
Always provide meaningful empty cart states with clear calls-to-action
Performance
Use image optimization with the
{{#img}}
wrapper for cart item thumbnailsAccessibility
Include proper ARIA labels and semantic HTML for cart interactions
Mobile First
Design cart widgets to work well on all screen sizes