Skip to content

Feat: WooCommerce orders open on new window - #730

Merged
AllTerrainDeveloper merged 3 commits into
WordPress:trunkfrom
mgiannopoulos24:feat/woocommerce-order-own-window
Sep 2, 2026
Merged

Feat: WooCommerce orders open on new window#730
AllTerrainDeveloper merged 3 commits into
WordPress:trunkfrom
mgiannopoulos24:feat/woocommerce-order-own-window

Conversation

@mgiannopoulos24

@mgiannopoulos24 mgiannopoulos24 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Closes #721.

The problem

Clicking an order in the WooCommerce Orders window navigated the list away, so the only route back was closing the window and reopening it from the dock.

Why

The bridge routes an admin link by comparing deriveWindowId( url ) against the source window's slug: same slug navigates the iframe in place, a different slug opens its own window. WooCommerce's High-Performance Order Storage moves the order editor off post.php?post=N&action=edit — where post has always been identity-bearing — onto admin.php?page=wc-orders&action=edit&id=N, which derives the Orders list's slug. The click read as in-page navigation.

id can't simply join the identity set: plugin list screens use admin.php?page=foo&action=…&id=N for row actions, and those must keep the list's slug so they run in place and land back on the list.

The fix

A scoped pass in src/utils.ts (scopedIdentityParams), keyed on the URL shape rather than on wc-orders:

  • admin.php + a page + action=edit + id=Nid is identity-bearing.
  • admin.php + a page + action=newaction is identity-bearing (the blank editor — Add order had the same problem, and the admin bar's + New → Order already spawned its own window).
  • Every other action= stays transient, so row actions still run in place.

An order now opens beside the Orders list, two orders are two windows, and closing one leaves the list where it was. Any plugin routing a feature through one admin.php?page= file gets the same behaviour.

Screenshot

image

Testing

  • 6 new tests: 4 in tests/vitest/utils.test.ts for the identity rule and its scoping, 2 in src/window/iframe-bridge.test.ts running the real slugifier through the dispatcher (order link → new window, order row action → in place).
  • npm run test:js (5355 passing), npm run lint, npm run typecheck, npm run build all clean. No PHP touched.

Docs

docs/bridge-protocol.md (the same-slug / cross-slug dispatch rules) and docs/javascript-reference.md (deriveWindowId, a Stable public API).

Open WordPress Playground Preview

@AllTerrainDeveloper AllTerrainDeveloper left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

@AllTerrainDeveloper
AllTerrainDeveloper merged commit 9e970a0 into WordPress:trunk Sep 2, 2026
5 checks passed
@mgiannopoulos24
mgiannopoulos24 deleted the feat/woocommerce-order-own-window branch September 2, 2026 11:26
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.

Open Woocommerce orders in a new window

2 participants