-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Fix: Implement woocommerce_merged_packages filter #58975
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
base: trunk
Are you sure you want to change the base?
Fix: Implement woocommerce_merged_packages filter #58975
Conversation
Enables ability to disable packages such as Brands from a plugin or theme using a filter.
WalkthroughA new WordPress filter hook, Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant WooCommerce Core
participant Packages Class
WooCommerce Core->>Packages Class: get_enabled_packages()
Packages Class->>Packages Class: Collect enabled merged packages
Packages Class->>Developer: Apply 'woocommerce_merged_packages' filter
Developer-->>Packages Class: (Optionally) modify packages array
Packages Class->>WooCommerce Core: Return final packages array
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yml 📒 Files selected for processing (2)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (2)
✨ 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
|
Submission Review Guidelines:
Changes proposed in this Pull Request:
The comment above the definition of
$merged_packages
in thePackages
class says "the packages included in this array can be deactivated via the 'woocommerce_merged_packages' filter", but that filter has not actually been implemented. This PR adds it to theget_enabled_packages
method, enabling plugin authors to selectively disable packages such as Brands like so:This change does not delete any data from the database, so re-enabling the feature restores any previous data throughout the admin and front-end automatically. All that is required is re-saving permalinks so that any relevant URLs are restored (e.g., brand archives if disabling/re-enabling Brands).
How to test the changes in this Pull Request:
/brand/test-brand/
returns a 404.Testing that has already taken place:
Changelog entry
Changelog Entry Details
Significance
Type
Message
Add ability for developers to disable packages that are developed outside of core (but are enabled in core via the
Packages
class) by using thewoocommerce_merged_packages
filter to unset unwanted packages.