Skip to main content
Use this hook when you need to track ongoing checkout actions and show loading states in your UI. It’s useful for disabling buttons, showing spinners, or preventing user interactions while the checkout is processing.
Let your agent build it. The Ollie Shop skill ships with projects created by npx create-ollie-shop and knows which action types to watch for a given piece of UI.
Prompt
Don’t have the skill yet? Install it.

Import

Return Value

ActionType values

pendingActions can contain any action type of useCheckoutAction:

How the list is cleared

The template uses the list to show skeletons and disable controls, so it never stays stuck:
  • An action is removed when it finishes, successfully or not.
  • The list is also cleared automatically after a short idle period, and shortly after a route or step change.
Treat hasPendingActions as “the checkout is busy right now”, not as an exact count.

Usage

Example

A totalizer component that shows a loading skeleton while cart-related actions are processing.

Notes

  • addActionNameForLoading and removeActionNameForLoading are called automatically by useCheckoutAction when actions start and complete. Call them yourself only for work of your own that should block the checkout the same way, and always remove what you add.
  • Use hasPendingActions for simple loading states, or filter pendingActions for more granular control.
  • Related: useCheckoutSession