Skip to content

ShoppingListAddButton

Single-list heart toggle. Reads the visitor's lists to know whether the SKU is saved, then adds to / removes from the default list. If no list exists yet, the add creates one seeded with the product (so a fresh visitor always succeeds).

import { ShoppingListAddButton } from "@evolve-storefront/feature-shopping-list/shopping-list-add-button";

Renders inside ShoppingListProvider.

Preview

DefaultOpen in Storybook ↗

Usage

Empty list — click the heart to add (async call + success toast + fill).

// Inside a ShoppingListProvider: it reads the lists and toggles the SKU.
<ShoppingListAddButton sku={product.sku} productName={product.name} />;

Props

PropTypeDescription
skustring
productName?string
className?string
icon?ReactNode

Replace the glyph (rung 3). Defaults to the wishlist heart.

Any other props go to the root element, like on a plain HTML element.