Examples
Checkout drawer
A full cart drawer with line items, totals, a promo row and a stacked footer that puts Checkout above Continue shopping.
Preview
Your cart
2 items
Mechanical keyboard
Qty 1, Cherry MX Brown
USB-C dock
Qty 1
Subtotal
$316.00
Shipping
Free
Total
$316.00
HTML
<bs:bsui-drawer position="right">
<bs:bsui-drawer-trigger trigger_label="View cart" trigger_variant="outline" />
<bs:bsui-drawer-backdrop />
<bs:bsui-drawer-popup>
<bs:bsui-text content="Your cart" variant="title" tag="h3" />
<bs:bsui-text content="2 items" variant="muted" />
<bs:bsui-separator />
<bs:bsui-stack direction="row" gap="3" align="center" justify="space-between">
<bs:bsui-stack direction="column" gap="1">
<bs:bsui-text content="Mechanical keyboard" variant="label" tag="span" />
<bs:bsui-text content="Qty 1, Cherry MX Brown" variant="caption" tag="span" />
</bs:bsui-stack>
<bs:bsui-text content="$227.00" variant="label" tag="span" />
</bs:bsui-stack>
<bs:bsui-stack direction="row" gap="3" align="center" justify="space-between">
<bs:bsui-stack direction="column" gap="1">
<bs:bsui-text content="USB-C dock" variant="label" tag="span" />
<bs:bsui-text content="Qty 1" variant="caption" tag="span" />
</bs:bsui-stack>
<bs:bsui-text content="$89.00" variant="label" tag="span" />
</bs:bsui-stack>
<bs:bsui-separator />
<bs:bsui-stack direction="row" gap="3" align="center" justify="space-between">
<bs:bsui-text content="Subtotal" variant="muted" tag="span" />
<bs:bsui-text content="$316.00" variant="label" tag="span" />
</bs:bsui-stack>
<bs:bsui-stack direction="row" gap="3" align="center" justify="space-between">
<bs:bsui-text content="Shipping" variant="muted" tag="span" />
<bs:bsui-text content="Free" variant="label" tag="span" />
</bs:bsui-stack>
<bs:bsui-stack direction="row" gap="3" align="center" justify="space-between">
<bs:bsui-text content="Total" variant="label" tag="span" />
<bs:bsui-text content="$316.00" variant="label" tag="span" />
</bs:bsui-stack>
<bs:bsui-stack direction="row" gap="2" align="center">
<bs:bsui-input name="promo" placeholder="Promo code" />
<bs:bsui-button label="Apply" variant="outline" />
</bs:bsui-stack>
<bs:bsui-drawer-footer>
<bs:bsui-drawer-close variant="default" label="Checkout" />
<bs:bsui-drawer-close variant="outline" label="Continue shopping" />
</bs:bsui-drawer-footer>
</bs:bsui-drawer-popup>
</bs:bsui-drawer>How it works
Line items, totals and the promo state all live in one cart store, and applying a code recomputes the derived totals in context before the footer reads them. The drawer keeps focus inside while open and returns it to the cart trigger on close.
Every behaviour on this page is the WordPress Interactivity API: each component registers its own store, seeds its state in a server rendered context, and wires events with directives in the markup above. There is no page specific JavaScript.