-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Add woocommerce_suggest_jetpack filter to exlude Jetpack suggestion in OBW #38286
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
Add woocommerce_suggest_jetpack filter to exlude Jetpack suggestion in OBW #38286
Conversation
|
Hi @adrianduffell, @rjchow, @woocommerce/ghidorah Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
Test Results SummaryCommit SHA: af67291
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## trunk #38286 +/- ##
==========================================
+ Coverage 51.2% 51.6% +0.3%
- Complexity 17439 17444 +5
==========================================
Files 440 440
Lines 80722 80297 -425
==========================================
+ Hits 41346 41403 +57
+ Misses 39376 38894 -482
|
d1fcefe to
0cd7c09
Compare
| * | ||
| * @since 7.8 | ||
| */ | ||
| if ( false === apply_filters( 'woocommerce_suggest_jetpack', true ) ) { |
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.
I'm wondering if "woocommerce_onboarding_suggest_jetpack" would be more explicit. What do you think?
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.
That was my first thought as well. However, I think we plan to use woocommerce_suggest_jetpack on other pages where we also suggest Jetpack.
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.
Yup we should roll this out everywhere Jetpack is suggested 👍
I'll audit wc-admin for this and create a new issue.
chihsuan
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 adding the filter!
Left a two minor suggestions. Others look good! 👍
Co-authored-by: Chi-Hsuan Huang <[email protected]>
adrianduffell
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.
LGTM @moon0326 🚀
I left a nitpick possible improvement, but feel free to merge without addressing it.
| */ | ||
| if ( false === apply_filters( 'woocommerce_suggest_jetpack', true ) ) { | ||
| foreach ( $extensions as &$extension ) { | ||
| $extension['plugins'] = array_filter( |
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.
Nitpick: Should the array_filter be used on $extensions so that it outright removes the extension completely?
I think at the moment, only the jetpack plugin slug would be removed from the extension data, but the extension still remains. I think this still works, but is dependent on the consuming code having a defensive check for an empty plugin array.
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.
@adrianduffell Good point. Let's merge it for now and get back to it later. I'm not sure if the client code is checking for the extension. We need to test it further if we want to remove the list completely.
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.
Sounds good!
| return RemoteFreeExtensions::get_extensions(); | ||
| $extensions = RemoteFreeExtensions::get_extensions(); | ||
| /** | ||
| * Remove Jetpack when woocommerce_suggest_jetpack is false. |
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.
Just a note: we use these comments to auto-generate docs, as well as lists of new filters introduced in a release. It'd be helpful in the future if the description more completely described the filter, such as "When false, Jetpack is removed from the list of suggested extensions."
No changes immediately required here, but please keep this in mind when adding these comments to future filters and when reviewing PRs that include new filters.
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.
/cc @chihsuan and @adrianduffell as reviewers as well
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.
@moon0326 I fixed the description used in the release post, but after some discussion, we'd still like this description improved in the code. Please create a PR to clean this up when you get a change. No need to request an exception to get it into the 7.8 cycle, but please do work toward getting it cleaned up in trunk.
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.
Thank you! @jonathansadowski
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.
cc @woocommerce/ghidorah for the rest of the team
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.
Great callout, @jonathansadowski!
| Significance: minor | ||
| Type: add | ||
|
|
||
| Add a filter to free extensions REST endpoint |
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.
Same comment here as below for the filter comment. This isn't very useful to somebody glancing over the changelog what the change entry means. Please consider the audience for the change entry. What does the filter do?
Submission Review Guidelines:
Changes proposed in this Pull Request:
Closes #38285
This PR adds
woocommerce_suggest_jetpackfilter to the free extensions REST endpoint to exclude Jetpack suggestion in OBW.How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
Business Details -> Free features