Skip to content

closed#3926

Closed
bashu-shopify wants to merge 3 commits into
mainfrom
bashu/standard-actions-override
Closed

closed#3926
bashu-shopify wants to merge 3 commits into
mainfrom
bashu/standard-actions-override

Conversation

@bashu-shopify

@bashu-shopify bashu-shopify commented May 27, 2026

Copy link
Copy Markdown

No description provided.

Storefront Renderer injects the Standard Actions bundle (window.Shopify.actions) into the page. The default updateCart handler already understands Dawn's cart refresh contract — it walks getSectionsToRender() on Dawn's cart custom elements, fetches /cart.js?sections= to morph sections in place, and publishes 'cart-update' through Dawn's pubsub.

This override adds the one Dawn-specific bit the defaults can't cover: openCart, which opens the <cart-drawer> dialog. Falls back to /cart when the drawer isn't rendered (cart_type = page, or already on the cart page).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Configure both openCart and updateCart explicitly in Dawn instead of relying on the bundle's built-in Dawn detection. Two reasons:

1. Forks that change Dawn's cart contract (custom elements, pubsub event shape, getSectionsToRender) silently break the built-in path. Putting the wiring in-theme keeps it visible and forkable.

2. Once most Dawn-based themes ship explicit integration, the built-in Dawn fallback in the actions bundle can be dropped.

The updateCart handler mirrors the bundle's built-in behavior: collect sections advertised by mounted cart custom elements (skipping those Dawn's own pubsub subscribers already refresh), fetch /cart.js?sections=, morph the DOM in place, then publish cart-update so subscribers (quick-add-bulk, price-per-item, recipient-form, …) react.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@bashu-shopify bashu-shopify reopened this May 28, 2026
@bashu-shopify bashu-shopify changed the title Add Standard Actions override for cart drawer Configure Standard Actions explicitly for Dawn May 28, 2026
- refreshDawnCartUI always fetches /cart.js so the published cart-update
  payload includes cartData even when no Dawn cart custom elements are
  mounted. Prevents quick-add-bulk.js from throwing on event.cartData.items
  on pages where cart_type = page or the header lacks <cart-drawer>.

- updateCart configuration sets eventTarget: () => document explicitly.
  The SSE bundle types mark eventTarget as required; runtime tolerates
  omission today but that's a latent contract violation.

- openCart delegates to defaultHandler() instead of duplicating the
  bundle's /cart redirect fallback.

- updateCart handler drops unused ...args (defaultHandler is pre-bound
  with payload/options/cartId).

- DAWN_CART_TAGS and DAWN_PUBSUB_REFRESHED_SECTIONS get inline
  maintenance comments pointing to the Dawn source-of-truth for the
  next person who touches cart.js#onCartUpdate.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@bashu-shopify bashu-shopify self-assigned this May 28, 2026
@bashu-shopify bashu-shopify deleted the bashu/standard-actions-override branch May 28, 2026 05:21
@bashu-shopify bashu-shopify changed the title Configure Standard Actions explicitly for Dawn closed May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant