-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Product Details: prevent the default template to be auto applied for existing blocks #59691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Product Details: prevent the default template to be auto applied for existing blocks #59691
Conversation
Testing GuidelinesHi @Aljullu , Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed. Reminder: PR reviewers are required to document testing performed. This includes:
|
📝 Walkthrough""" WalkthroughA patch-level fix was introduced to the WooCommerce product details block to address template application behavior. The Changes
Sequence Diagram(s)sequenceDiagram
participant Editor
participant EditComponent
participant LegacyProductDetailsPreview
Editor->>EditComponent: Render Product Details Block
EditComponent->>EditComponent: Check hasInnerBlocks & wasBlockJustInserted
alt Block has inner blocks or was just inserted
EditComponent->>EditComponent: Render inner blocks container (with template if just inserted)
else
EditComponent->>LegacyProductDetailsPreview: Render legacy preview (hideTabTitle: true)
end
""" 📜 Recent review detailsConfiguration used: .coderabbit.yml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Size Change: +1.39 kB (+0.02%) Total Size: 5.86 MB
|
Test using WordPress PlaygroundThe changes in this pull request can be previewed and tested using a WordPress Playground instance. Test this pull request with WordPress Playground. Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirming <!-- wp:woocommerce/product-details {"className":"is-style-minimal"} /-->
stays as the legacy block:

From the testing steps:
See the Accordion layout is used for the newly inserted block.
Reload the editor again.
Delete the Accordion Group block inside Product Details.
See the legacy editor preview of the previous version of the block rendered.
This doesn't work if I don't reload the editor, but I guess that's expected, right?
Testing environment
- WordPress 6.8.1 local dev environment
- Plugins: WooCommerce Beta Tester
- Theme: TT5
- Store creation: June 2025
- Store size: small
@Aljullu yes, if you just inserted the Product Details block and delete the Accordion right away, it won't show the preview. Let me update the instructions to mention that. |
Submission Review Guidelines:
Changes proposed in this Pull Request:
This PR prevents the existing Product Details blocks from upgrading to the new Accordion layout automatically and ensures the new layout will only be applied to newly inserted blocks.
Closes #59663
Closes wooplug-5015
(For Bug Fixes) Bug introduced in PR #59005
Screenshots or screen recordings:
Screen.Recording.2025-07-16.at.09.41.16.mov
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
<!-- wp:woocommerce/product-details {"className":"is-style-minimal"} /-->
. This simulates the existing Product Details block.Note: If the Accordion Group block is deleted right after being inserted into the editor, the legacy preview won't show. The preview is added to maintain backward compatibility for existing instances of the block.