Skip to main content
FairShare gives shoppers two forms of cart feedback. If your theme keeps its own cart sidebar or its own add button, see Build a custom cart drawer. The two forms are:
  • Declarative cart buttons show a loading spinner by default.
  • The built-in success and error toast is opt-in.
These defaults are independent. You can keep automatic loading feedback without showing a toast.

Configure loading buttons

Buttons that use data-fluid-add-to-cart or data-fluid-add-enrollment-pack show a spinner while their request is in flight. The SDK disables the button, sets aria-busy="true", and restores the button’s previous state when the request settles. Add data-fluid-loading-text to replace the label during the request:
To disable automatic spinners, set the kill switch on the Fluid SDK script:
If your theme cannot edit the injected script, disable the behavior at runtime:
Setting data-fluid-button-loading="true" is unnecessary because the spinner is already on by default. For a custom button that calls a cart method directly, wrap the promise with withButtonLoading(). This helper clears the loading state whether the operation succeeds or throws. Every Fluid storefront creates carts in the background, so the spinner now runs until the cart is filled, not only until the request returns:

Enable the built-in toast

The toast remains off until you explicitly enable it. If you control the SDK script, add data-fluid-toast="true":
Theme JavaScript can enable and configure it after the SDK is attached:
Runtime configuration takes precedence over script attributes. Fields you omit continue to use the script attribute or built-in default. The error message also applies when a store that creates carts in the background cannot add the shopper’s items. See cart population failures. Valid positions are bottom-center, bottom-left, bottom-right, top-center, top-left, and top-right.

Style the toast

The toast renders in the light DOM, so theme CSS can target it directly. It uses id="fluid-toast" plus data-variant, data-position, and data-state attributes.
The toast uses role="status" for success and role="alert" for errors. Shoppers can dismiss it with its close button. It also dismisses automatically after the configured duration. A custom button that wants the SDK cart drawer must also open it at the click. See Build a custom cart drawer. For cart operation events and per-call toast suppression, see the FairShare cart API guide. For SDK installation details, see install FairShare.