Skip to content

fix: keep Meta Boxes pane open by default for WooCommerce Builder products - #2926

Open
Soare-Robert-Daniel wants to merge 7 commits into
masterfrom
fix/woo-builder-meta-boxes-visibility
Open

fix: keep Meta Boxes pane open by default for WooCommerce Builder products#2926
Soare-Robert-Daniel wants to merge 7 commits into
masterfrom
fix/woo-builder-meta-boxes-visibility

Conversation

@Soare-Robert-Daniel

@Soare-Robert-Daniel Soare-Robert-Daniel commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Products using WooCommerce Builder lost their WooCommerce Product data panel (price, inventory, shipping, …) on the edit screen. The builder forces the block editor for enabled products, and since Otter 3.2.0 bumped all blocks to apiVersion 3 (#2833), WordPress 6.7+ iframes that editor and renders meta boxes in a bottom drawer that starts collapsed — hiding the panel entirely. This PR defaults the drawer to open on builder products and rescues the panel when a saved metabox layout strands it in the narrow side column. Reported through Neve Pro support (HelpScout conversation 3335039496); full root-cause analysis in this issue comment.

What changed

  • WooCommerce_Builder — builder-enabled product screens now default the meta-boxes drawer to open (core/preferencessetDefaults). Before → after: thin collapsed "Meta Boxes" bar, panel invisible → panel visible without interaction.

  • WooCommerce_Builder — a meta-box-order_product user option that strands woocommerce-product-data in the side area (one click on the metabox move arrows persists that silently) is corrected back into the main area at render time, keeping the panel out of the ~280px sidebar where its layout breaks.

  • e2e environment — WooCommerce mounted in .wp-env.json as an inactive plugin (the Composer copy, refreshed to 10.9.4) and activated only around this spec; the product-creation endpoint clears WooCommerce's activation-redirect transient; the otter-e2e/v1 bootstrap gains product create/delete and user-meta helpers backing the new woocommerce-builder.spec.js, which cleans up every product it publishes.

Note

Both fixes are presentation-time only: setDefaults never overrides a drawer preference the user has explicitly saved, and the stored metabox-order user option is left untouched.

Product edit screen flow

flowchart LR
    A[Open product<br/>edit screen] --> B{Builder enabled<br/>on product?}
    B -- No --> C[Classic editor,<br/>panel as before]
    B -- Yes --> D[Block editor:<br/>meta boxes in drawer]
    D --> E{New:<br/>saved drawer<br/>preference?}:::added
    E -- Yes --> F[Apply saved<br/>preference]
    E -- No --> G[New:<br/>drawer opens]:::added
    D --> H{New:<br/>Product data<br/>in side area?}:::added
    H -- Yes --> I[New: rendered<br/>in drawer]:::added
    H -- No --> J[Positions<br/>as saved]

    classDef added fill:#1a7f37,color:#fff,stroke:#116329,stroke-width:3px
Loading

QA

  1. With WooCommerce, Otter Blocks, and Otter Pro active, edit a product, click Enable WooCommerce Builder in the side metabox, then reopen the product.
    Expect: the block editor loads with the Product data panel (price fields under General) visible at the bottom, with no extra clicks.

  2. Collapse the drawer by activating the Meta Boxes bar, wait a couple of seconds for the preference to save, then reload the editor.
    Expect: the drawer stays collapsed — the saved preference wins over the new default.

  3. Plant the corrupted metabox layout, then reload the builder product's edit screen:

    wp user meta update <admin-user-id> meta-box-order_product \
      '{"normal":"","advanced":"commentsdiv,postexcerpt","side":"woocommerce-product-data,otter_woo_builder,woocommerce-product-images"}' \
      --format=json

    Expect: Product data renders inside the bottom drawer, not crushed into the settings sidebar.

  4. Open a regular post and a product without the builder.
    Expect: unchanged behavior — the post editor's drawer keeps its stock default, and the product opens in the classic editor with Product data in place.

Closes #2822

🤖 Generated with Claude Code

…ducts

Since WP 6.7 the iframed post editor renders meta boxes in a bottom drawer
that is collapsed unless the user previously opened it. Otter 3.2.0 bumped
all blocks to apiVersion 3, which switched WooCommerce Builder product edit
screens to the iframed canvas, hiding the WooCommerce Product data panel
(price, inventory, etc.) behind the collapsed drawer.

Default the drawer to open on builder-enabled product screens via the
preferences setDefaults API, which never overrides an explicit user choice.

Closes #2822

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 27, 2026 07:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Defaults the Meta Boxes drawer to open for WooCommerce Builder products while preserving explicit user preferences.

Changes:

  • Registers an editor-assets hook for builder-enabled products.
  • Sets metaBoxesMainIsOpen through WordPress preferences.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +47 to +48
public function show_meta_boxes_pane() {
if ( 'product' !== get_post_type() || ! boolval( get_post_meta( get_the_ID(), '_themeisle_gutenberg_woo_builder', true ) ) ) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added in 3bc2a95tests/test-woocommerce-builder.php creates the post contexts and inspects the wp-edit-post inline data: the default is present for a builder-enabled product and absent for both a product without the builder and a regular post.

@pirate-bot

Copy link
Copy Markdown
Contributor

Bundle Size Diff

Package Old Size New Size Diff
Animations 178.33 KB 178.33 KB 0 B (0.00%)
Blocks 1.65 MB 1.65 MB 0 B (0.00%)
CSS 7.83 KB 7.83 KB 0 B (0.00%)
Dashboard 172.49 KB 172.49 KB 0 B (0.00%)
Onboarding 68.14 KB 68.14 KB 0 B (0.00%)
Export Import 4.73 KB 4.73 KB 0 B (0.00%)
Pro 439.82 KB 439.82 KB 0 B (0.00%)

@pirate-bot

pirate-bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Plugin build for 9a2a00e is ready 🛎️!

@pirate-bot

pirate-bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

E2E Tests

Playwright Test Status: See serial and parallel matrix jobs

Performance Results serverResponse: {"q25":284.9,"q50":315.6,"q75":327.7,"cnt":10}, firstPaint: {"q25":1070.3,"q50":1103.5,"q75":1231.1,"cnt":10}, domContentLoaded: {"q25":2900.8,"q50":2930.95,"q75":2949.9,"cnt":10}, loaded: {"q25":2902.6,"q50":2932.5,"q75":2951.5,"cnt":10}, firstContentfulPaint: {"q25":3281.1,"q50":3313.25,"q75":3336.3,"cnt":10}, firstBlock: {"q25":11452.5,"q50":11473.75,"q75":11483.4,"cnt":10}, type: {"q25":21.27,"q50":22.48,"q75":24.5,"cnt":10}, typeWithoutInspector: {"q25":21.88,"q50":24.97,"q75":30.17,"cnt":10}, typeWithTopToolbar: {"q25":32.17,"q50":33.58,"q75":39.54,"cnt":10}, typeContainer: {"q25":13.88,"q50":14.4,"q75":15.06,"cnt":10}, focus: {"q25":107.05,"q50":115.06,"q75":119.38,"cnt":10}, inserterOpen: {"q25":35.32,"q50":37.23,"q75":38.27,"cnt":10}, inserterSearch: {"q25":13.53,"q50":14.72,"q75":17.27,"cnt":10}, inserterHover: {"q25":5.44,"q50":5.83,"q75":6.2,"cnt":20}, loadPatterns: {"q25":1447.47,"q50":1478,"q75":1497.77,"cnt":10}, listViewOpen: {"q25":185.09,"q50":194.31,"q75":205.66,"cnt":10}

The metabox Move-up/down arrows persist the order instantly and, at the
edge of an area, relocate a box into the adjacent area. From the block
editor (WooCommerce Builder products) one accidental click can strand
woocommerce-product-data in 'side', where it renders inside the ~280px
sidebar and its layout breaks. Correct it at read time via the
get_user_option_meta-box-order_product filter.

Adds Playwright coverage for the builder edit screen: drawer open by
default, side-area rescue, classic-editor scoping for non-builder
products, and explicit user preference winning over the new default.
WooCommerce (latest stable) joins .wp-env.json; the e2e bootstrap gains
product-creation and user-meta helpers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 27, 2026 08:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Comment thread plugins/otter-pro/inc/plugins/class-woocommerce-builder.php
Comment thread src/blocks/test/e2e/blocks/woocommerce-builder.spec.js Outdated
…her suites

- Add the missing void return type that failed PHPStan.
- Scope restore_product_data_location() to builder-enabled products, so a
  layout saved on a classic product is left as the user arranged it.
- Add PHPUnit coverage for both guards: the inline meta-boxes-pane default
  (present for builder products, absent for plain products and non-product
  posts) and the metabox-order rescue.
- Mount WooCommerce as an inactive wp-env mapping from the copy composer
  already installs, and activate it only around the WooCommerce spec.
  Activating it for the whole environment changed editor load behavior and
  broke the performance suite.
- Reset the shared admin user's drawer preference and metabox order in
  beforeEach as well as afterEach, so the first test is not skewed by
  state left behind by an earlier run.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 27, 2026 09:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread tests/test-woocommerce-builder.php Outdated
Mounting WooCommerce at wp-content/plugins/woocommerce made the existing
activate_plugin() call in the bootstrap resolve — it had been a silent
no-op while that directory did not exist. activate_plugin() includes the
plugin file through plugin_sandbox_scrape(), so WooCommerce was loaded
via two different paths and PHP fataled on redeclaring the unguarded
WC() and wc_get_container() functions, failing the suite with exit 255
before any test ran.

Load the mounted copy when present so both includes resolve to the same
path, keeping the vendor copy as a fallback.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 27, 2026 09:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread .wp-env.json
Comment on lines +61 to +62
test( 'builder products open in the block editor with the Product data panel visible', async({ admin, page, otterUtils }) => {
const { id } = await otterUtils.createWooProduct({ builder: true });

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 6fd2307. Creations now go through a helper that records each id, and afterEach hard-deletes exactly those. It runs before afterAll deactivates WooCommerce, so the deletes also clear its product lookup tables, and the endpoint skips any id whose post type is not product so a stale id cannot remove unrelated content.

Each test published a product and teardown only reset user metadata, so a
reused wp-env gained four products per run and later product suites could
run against that residue.

Track the ids the spec creates and hard-delete exactly those in afterEach,
while WooCommerce is still active so its product lookup tables are cleaned
too. The endpoint ignores ids that are not products, so a stale id cannot
remove unrelated content.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 27, 2026 10:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

tests/test-woocommerce-builder.php:74

  • Removing the dummy handle here leaves the shared $wp_scripts registry without WordPress's original wp-edit-post registration, so tests that run afterward can fail depending on suite order. Reset the registry after this test so WordPress recreates all default script registrations on the next access.
		wp_scripts()->remove( 'wp-edit-post' );

Removing the dummy wp-edit-post handle in teardown left the shared
$wp_scripts registry without WordPress's own registration, so later tests
could fail depending on suite order. Discard the registry instead, which
makes the next wp_scripts() call rebuild every default registration.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 27, 2026 11:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

The composer constraint is open but the lock still pinned 10.1.2 from a
year ago, so mounting the Composer copy meant neither the new regression
suite nor the PHPUnit bootstrap exercised current WooCommerce, and the
pin also contradicted the php-stubs/woocommerce-stubs ^10.8 requirement.

Refresh the lock to 10.9.4, the version the regression was reproduced on.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 27, 2026 11:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated no new comments.

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.

WooCommerce Builder can hide Product data panel for enabled products

3 participants