---
title: Standard storefront events and actions
description: >-
  Standard storefront events and actions are the interface that themes use to
  communicate with apps and agents on the storefront.
source_url:
  html: >-
    https://shopify.dev/docs/storefronts/themes/best-practices/standard-events-and-actions
  md: >-
    https://shopify.dev/docs/storefronts/themes/best-practices/standard-events-and-actions.md
---

# Standard storefront events and actions

Standard storefront events and actions are the interface that themes use to communicate with apps and agents on the storefront. Themes dispatch events when commerce interactions occur, and apps trigger theme behaviors by calling actions. Both work across all themes that support them, so apps integrate without parsing theme DOM structure or intercepting `window.fetch`.

***

## Standard storefront events

Themes dispatch [standard storefront events](https://shopify.dev/docs/storefronts/themes/best-practices/standard-events) when commerce interactions occur on the storefront, such as product views, cart updates, and collection filter changes. Apps listen for these events with `addEventListener` to drive personalization, integrations, or custom UI updates.

Events dispatch from theme code at the point where the interaction occurs.

***

## Standard storefront actions

[Standard storefront actions](https://shopify.dev/docs/storefronts/themes/best-practices/standard-actions) are async functions on `Shopify.actions` that apps and agents call to request a theme behavior, such as adding to cart, opening the cart drawer, or fetching the current cart. The theme decides how to handle each call.

Shopify provides a default implementation for every action. `updateCart` writes to the Storefront API and refreshes the cart in place when possible, falling back to a page reload. `openCart` opens a cart drawer if one exists, and otherwise redirects to `/cart`. `getCart` reads the current cart from the Storefront API. Themes override the defaults to replace those behaviors with custom UI updates, such as opening a drawer or updating a counter in place.

When a configured action succeeds, the action runtime auto-emits the matching standard events. An app that calls `updateCart` doesn't need to also dispatch `shopify:cart:lines-update`.

***

## Developer tools

### CLI dev bundle

During local development with `shopify theme dev`, the CLI loads a dev build of the standard events runtime instead of the production build. This build validates event payloads and logs warnings when fields are malformed or missing. These checks are stripped in production.

### Events and actions inspector

Pass the `--standard-events-inspector` flag to [`shopify theme dev`](https://shopify.dev/docs/api/shopify-cli/theme/theme-dev) to inject a floating debug UI into local dev pages. The inspector has two tabs:

* **Events** shows every emitted standard event in real time with full payloads.
* **Actions** lets you dispatch actions and inspect their results.

***

## Get started

[Standard storefront events\
\
](https://shopify.dev/docs/storefronts/themes/best-practices/standard-events)

[Dispatch events from your theme, or listen for them in your app.](https://shopify.dev/docs/storefronts/themes/best-practices/standard-events)

[Standard storefront actions\
\
](https://shopify.dev/docs/storefronts/themes/best-practices/standard-actions)

[Override actions in your theme, or call them from your app.](https://shopify.dev/docs/storefronts/themes/best-practices/standard-actions)

***
