ShoppingCart Widget

The ShoppingCart widget displays the current cart item count as a badge in a selected page element. It checks the cart when the page loads and updates the badge when a shopper adds an item.

Navigation menu with a My Cart item-count badge.

Add the widget to a page

Load the widget through SitePages.config and select the page element where CyberStore should insert the badge.

<Control src="LoadWidgetControl.ascx"
    FileLocation="ShoppingCart.html"
    Options="badgeParentSelector: '.icon-banknote',
        checkCartInterval: 5000" />

The selected badgeParentSelector can be an element ID, CSS class, or HTML element name. Confirm that the target exists in the page or theme where the widget is loaded.

Widget options

Option Default Valid values or format Effect
badgeParentSelector
String
Not specified Element ID, CSS class, or HTML element name Identifies where the cart badge is inserted.
checkCartInterval
Number
5000 Milliseconds Sets how often the widget checks the cart for an updated item count.

For the cart rules behind the count, see Shopping Cart Logic.

Validate the badge

  1. Load a page that contains the configured badge target.
  2. Confirm the current item count appears after the page loads.
  3. Add an item to the cart and confirm the count updates.
  4. Test the page at the configured check interval to confirm the badge continues to reflect the active cart.

This site uses Just the Docs, a documentation theme for Jekyll.