-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Add fallback for store notice #59729
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
Conversation
Testing GuidelinesHi @Manussakis , 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:
|
📝 WalkthroughWalkthroughA fallback mechanism was added to ensure WooCommerce store notices are displayed even if the Changes
Sequence Diagram(s)sequenceDiagram
participant Theme
participant WordPress
participant WooCommerce
Note over Theme,WordPress: Page load begins
WordPress->>Theme: Render page
Theme-->>WordPress: Fires hooks (wp_body_open, wp_footer, etc.)
alt Theme supports wp_body_open
WordPress->>WooCommerce: Trigger woocommerce_demo_store on wp_body_open
WooCommerce->>WordPress: Output store notice
else Theme does NOT support wp_body_open
WordPress->>WooCommerce: Trigger anonymous function on wp_footer
WooCommerce->>WooCommerce: Check did_action('wp_body_open')
alt wp_body_open not triggered
WooCommerce->>WordPress: Output store notice via woocommerce_demo_store
else wp_body_open triggered
Note over WooCommerce: Do nothing (already shown)
end
end
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: .coderabbit.yml 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (24)
✨ Finishing Touches
🧪 Generate unit tests
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
|
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. |
I think I noticed this on a clients website, the store notices do not seem to be showing up, will this be updated in the next version oc woocommerce ? |
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.
17fcd9f
to
58d0f02
Compare
The store notice hook changed from wp_footer to wp_body_open in #55494 to improve accessibility. Old themes don't necessarily have support for wp_body_open - it was introduced in WP5.2 which means that the store notice wasn't appearing. This change fixes the problem by outputting the store notice in the footer again if the wp_body_open hook hasn't been called.
2262912
to
e2ffb9b
Compare
Submission Review Guidelines:
Changes proposed in this Pull Request:
The store notice hook changed from wp_footer to wp_body_open in #55494 to improve accessibility. Old themes don't necessarily have support for wp_body_open - it was introduced in WP5.2 which means that the store notice wasn't appearing.
This change fixes the problem by outputting the store notice in the footer again if the wp_body_open hook hasn't been called.
Closes https://linear.app/a8c/issue/THEME-37 .
(For Bug Fixes) Bug introduced in PR #55494 .
Screenshots or screen recordings:
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
Before this change, the store notice wasn't being displayed, now it is.
You should also check:
Testing that has already taken place:
I followed my own steps above on a fresh new checkout of WooCommerce using a fresh new wp-env'd wp.
Changelog entry
Changelog Entry Details
Significance
Type
Message
Fallback to displaying store notices via the
wp_footer
hook if thewp_body_open
hook didn't fire. This improves compatibility with themes that haven't been updated to include thewp_body_open
hook.Changelog Entry Comment
Comment