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
Reduce the amount of terms shown in attributes page #33962
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
the
plugin: woocommerce
Issues related to the WooCommerce Core plugin.
label
Jul 18, 2022
…page The attributes page displays all the terms for all the existing product attributes, which causes a performance problem in sites with a lot of attributes and terms. This commit limits the number of attributes shown to 100 by default, but it also introduces a woocommerce_max_terms_displayed_in_attributes_page filter to customize it.
Konamiman
force-pushed
the
reduce-terms-shown-in-attributes-page
branch
from
July 18, 2022 15:03
3240004
to
00b99de
Compare
Konamiman
requested review from
a team and
barryhughes
and removed request for
a team
July 18, 2022 15:04
Test Results SummaryCommit SHA: f042e28
To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
Konamiman
requested review from
vedanshujain
and removed request for
barryhughes
July 20, 2022 08:51
vedanshujain
approved these changes
Jul 22, 2022
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! I think you need to rebase from trunk to get tests to pass.
Hi @Konamiman, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:
|
jacob-sewell
pushed a commit
that referenced
this pull request
Jul 29, 2022
The attributes page displays all the terms for all the existing product attributes, which causes a performance problem in sites with a lot of attributes and terms. This commit limits the number of attributes shown to 100 by default, but it also introduces a woocommerce_max_terms_displayed_in_attributes_page filter to customize it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
All Submissions:
Changes proposed in this Pull Request:
As mentioned in #26539 (comment), the product attributes page lists all the existing product attributes together with all the existing terms for each one. In order to improve the performance of that page, the number of terms shown for each attribute is now limited to 100 by default, but this value can be customized by using the newly introduced
woocommerce_max_terms_displayed_in_attributes_page
filter.Additionally, the
get_terms( $taxonomy)
call is changed intoget_terms(['taxonomy' => $taxonomy, 'fields' => 'names'])
so that only term names are retrieved instead of the full set of terms information.The UI is adjusted accordingly as well. This is how it looks like when the filter returns 3:
And this is with the filter returning zero:
How to test the changes in this Pull Request:
add_filter('woocommerce_max_terms_displayed_in_attributes_page', function() {return 3;});
Other information:
pnpm changelog add --filter=<project>
?FOR PR REVIEWER ONLY: