-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Fix loading wc admin scripts on unrelated WP admin pages #57186
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
Fix loading wc admin scripts on unrelated WP admin pages #57186
Conversation
* Fix admin script loading condition in WCAdminSharedSettings Updated the admin script enqueue logic to check if the current page is an admin or embed page before loading the deprecation scripts. This improves performance by preventing unnecessary script loading on non-relevant pages. * Add changelog
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:
|
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. |
Aljullu
left a comment
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.
Thanks for working on this, @louwie17! Code changes look good to me. I tested with the Speed Controller by SiteGround plugin and confirmed the error is gone:
| Before | After |
|---|---|
![]() |
![]() |
Testing environment
- WordPress 6.8-RC3 local dev environment
- Plugins: WooCommerce, WooCommerce Beta Tester, WordPress Beta Tester and Speed Controller by SiteGround
- Theme: Twenty Twenty-Five
- Store creation: April 6th 2025
- Store size: small
|
WooCommerce 9.8.1 breaks compatibility with WPCodeBox 2, and we cannot access it now as shown in the attached photo. The support of WPCodeBox 2 said it is waiting for WooCommerce to rollout the fix at #57186 in order to resolve the issues. May we know when the new fixes will be rolled out ? Thank you. |
|
Hi there, @ysc711. WooCommerce 9.8.2 has just been released including this fix. |
|
Hi woocommerce/woocommerce,
Thanks for contacting us !
Your request (#010015693) has been received and is being reviewed by our Support Team and we'll get back to you as soon as we can.
In the meantime, here are some FAQs that may assist you quickly:
==========================================
Question 1: How to track my shipping status ?
Please input your tracking no. by clicking this link. Your tracking no. can be found in an email generated by our system automatically after you have placed the order. Please check your spam folder if you cannot find the email in your Inbox.
Question 2: How long will your support reply to my email ?
We will try to respond to your email in 24 hours. Thank you very much for your patience.
Question 3: How to check the product details ?
Please visit our store at https://iSmartHomeGadgets.com. You can either check the top menu bar or 12 collections at the bottom based on the product categorization. You can also search for the product name via the 🔍 icon at the top right corner.
Question 4: How can I place a bulk order for wholesale ?
Please send your purchase list to us, which should include product name, quantity and other special requests (if any). You can get in touch with us at ***@***.***
===========================================
If you cannot find your answers above, please be assured that our support team will get back to you as soon as possible. We wish you and your family stay safe, healthy and all the best :)
Best Regards,
Sophia
iSmart Home Gadgets
https://iSmartHomeGadgets.com
|



Updated the admin script enqueue logic to check if the current page is an admin or embed page before loading the deprecation scripts. This improves performance by preventing unnecessary script loading on non-relevant pages.
Submission Review Guidelines:
Changes proposed in this Pull Request:
Note: this is already merged to trunk, but the issue also exists in the 9.8 release, see this issue for example: #57183
WC 9.8 (PR: #55707) introduced a bug where the
settings-deprecationscript is loaded on all admin pages without any condition, so all its dependencies are also loaded.This PR adds a condition to check if the current page is an admin or embed page before loading deprecation scripts to ensure we only load the script on relevant pages.
Screenshots or screen recordings:
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
/woocommerce/assets/client/adminscripts not being loadedwcsettings-deprecation.jsis still being loaded correctlyTesting that has already taken place:
Changelog entry
Changelog Entry Details
Significance
Type
Message
Changelog Entry Comment
Comment