Skip to content

Restore block compatibility with WordPress 7.2 - #70075

Closed
gigitux wants to merge 2 commits into
trunkfrom
fix/wordpress-72-block-compatibility
Closed

gigitux wants to merge 2 commits into
trunkfrom
fix/wordpress-72-block-compatibility

Conversation

@gigitux

@gigitux gigitux commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Submission Review Guidelines:

Changes proposed in this Pull Request:

WordPress 7.2 skips deprecated two-hyphen IDs on Interactivity API lifecycle directives, leaving variation validation, galleries, thumbnail overflow, Mini-Cart hydration, and filter synchronization callbacks inactive. Switch those IDs to the supported three-hyphen syntax, restore the deprecated Products Query variation by subscribing to the core/editor store its selectors already read, and update editor test selectors for the WordPress 7.2 controls. Add post-editor regression coverage while preserving the original Site Editor inheritance-toggle test.

The directive behavior changed in Gutenberg PR #84098; the supported syntax was announced in the WordPress 6.9 Interactivity API developer note. The affected IDs were added across earlier WooCommerce changes, including #60113, #60274, #63014, #64586, and #65622.

For the Product Query selector/subscription mismatch: Bug introduced in PR #60541. The post-editor registration is also guarded so it cannot overwrite the Site Editor's template-specific variation attributes.

Compatibility: no public signatures, hooks, saved block attributes, or variation names change. The directive syntax is supported on the currently supported WordPress versions; editor registration now observes the same store as its selectors. This affects shopper-facing add-to-cart behavior and editor registration timing, so it is marked impact: high and requires an independent human review.

Investigated from the WordPress 7.2 CI failure.

Screenshots or screen recordings:

Existing behavior and controls are restored; no visual design changes.

How to test the changes in this Pull Request:

  1. Test with WordPress 7.2 beta 1 and repeat with WordPress 7.1, a block theme, and WooCommerce sample products. Build the blocks assets before testing.

  2. In Appearance > Editor, open the Product Catalog template and select an existing Products (Deprecated) block. If necessary, insert the variation from the browser console:

    const variation = wp.blocks.getBlockVariations( 'core/query' ).find(
        ( item ) => item.name === 'woocommerce/product-query'
    );
    wp.data.dispatch( 'core/block-editor' ).insertBlocks(
        wp.blocks.createBlock(
            'core/query',
            variation.attributes,
            wp.blocks.createBlocksFromInnerBlocksTemplate( variation.innerBlocks )
        )
    );
  3. Confirm Inherit query from template is visible. Disable it and confirm Advanced Filters becomes available; enable it again and confirm those filters are hidden.

  4. In a new post, insert the same variation using the console snippet. Confirm Advanced Filters is available and Inherit query from template is hidden.

  5. On a variable product using the Add to Cart + Options block, try adding it without selecting required options, then select a valid variation and add it. Confirm validation and add-to-cart work.

  6. With Product Gallery on a variable product, change and clear the selected variation. Repeat with the classic Add to Cart Form. Confirm the gallery updates and restores the parent images. For a product with many images, confirm thumbnails scroll and the final thumbnail is reachable.

  7. Place two Product Filters blocks targeting the same collection. Apply and remove filters in either instance and confirm both stay synchronized. Check filter chip colors, overlay scrolling, and that the Mini-Cart remains visible after client-side navigation.

  8. Run the focused block E2E tests for product-collection inspector controls, attribute-filter style controls, and accessing the Checkout template from its page. Confirm they pass on both WordPress versions.

Testing that has already taken place:

  • Docker wp-env, PHP 8.3, block theme, WooCommerce sample data, WordPress 7.1 and 7.2 beta 1.
  • Focused storefront and editor E2E suites: 21 test cases passed on each WordPress version (plus setup). This covers the original failing behaviors and the new post-editor Product Query regression.
  • Confirmed the original Site Editor inheritance test fails on WordPress 7.2 without the Product Query registration fix and passes with it.
  • lint:php:changes and lint:changes:branch completed successfully; PHP checks are clean. Branch ESLint reports four existing warnings on unchanged lines in the Product Collection page object and Attribute Filter fixture.
  • Full blocks lint:js completed with zero errors and existing warnings. The changed Product Query source and new regression test lint cleanly.
  • PHPStan passed for all seven modified PHP files; the baseline is unchanged. git diff --check is clean.
  • Multisite and third-party extensions were not tested. No site-scoped storage, network options, database schema, or install paths change.

Milestone

Note: Check the box above to have the milestone automatically assigned when merged.
Alternatively (e.g. for point releases), manually assign the appropriate milestone.

Changelog entry

  • Automatically create a changelog entry from the details below.
  • This Pull Request does not require a changelog entry. (Comment required below)
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Changelog Entry Comment

Comment

Created manually.

Use of AI Tools

Codex assisted with implementation, regression coverage, and local validation. Independent human review is pending.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

focus: e2e tests Issues related to e2e tests impact: high To be added by the PR author/reviewer if the PR could very likely cause SEV-1 or SEV-2 issues plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant