salla-cart-summary
Cart link showing the item count and total, usually placed in the theme header.
Cart link showing the item count and total, usually placed in the theme header. It updates itself whenever the cart changes and starts from the values saved in local storage.
The link goes to the cart page. If a store scope is set, scope (and allocation_type / allocation_id when present) are added to the cart URL.
Use it
In HTML or JSX, use the tag <salla-cart-summary> with the Attribute names below. In React, the wrapper takes the Property names (camelCase).
import { SallaCartSummary } from '@salla.sa/twilight-components-react/cart-summary';Client-only. On the server this wrapper renders a placeholder (a skeleton, or nothing), and the real component mounts in the browser. Do not rely on it for content that search engines must see.
Example
import { SallaCartSummary } from '@salla.sa/twilight-components-react/cart-summary';
export function Example() {
return (
<SallaCartSummary showCartLabel />
);
}Properties
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
showCartLabel | show-cart-label | Shows a text label ("Cart", or "السلة" when the user language is Arabic) before the total. | boolean |
Methods
Call these on the element or a React ref.
animateToCart(image: any) => Promise<void>
Animates a copy of a product image flying to the cart icon, then plays a bounce on the icon. Does nothing (only logs) if the element has no src.
| Parameter | Type | Description |
|---|---|---|
image | any | The product <img> element to animate from; its position, size and src are used. |
Slots
| Slot | Description |
|---|---|
icon | Replaces the default cart icon. |
salla-cart-item-offers
Lists the offers (discounts, free items) that were applied to one line in the cart, with the name and discount amount of each.
salla-cashback-banner
A small banner on the product page that tells the shopper how much cashback they earn for buying the product (for example "Earn 10 SAR when buying this product").