Skip to content
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 a filter woocommerce_admin_terms_metabox_datalimit to change the data-limit value for the attributes term box #45506

Merged
merged 5 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions plugins/woocommerce/changelog/fix-37548
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Add a filter to adjust the 50 terms limitation in the product edit page.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

Check notice on line 1 in plugins/woocommerce/includes/admin/meta-boxes/views/html-product-attribute-inner.php

View workflow job for this annotation

GitHub Actions / Analyze Branch Changes

new filter found - woocommerce_admin_terms_metabox_datalimit

\'woocommerce_admin_terms_metabox_datalimit\' introduced in 8.8.0
/**
* Product attribute table for reuse.
*
Expand Down Expand Up @@ -37,10 +37,17 @@

if ( 'select' === $attribute_taxonomy->attribute_type ) {
$attribute_orderby = ! empty( $attribute_taxonomy->attribute_orderby ) ? $attribute_taxonomy->attribute_orderby : 'name';
/**
* Filter the length (number of terms) rendered in the list.
*
* @since 8.8.0
* @param int $term_limit The maximum number of terms to display in the list.
*/
$term_limit = absint( apply_filters( 'woocommerce_admin_terms_metabox_datalimit', 50 ) );
?>
<select multiple="multiple"
data-minimum_input_length="0"
data-limit="50" data-return_id="id"
data-limit="<?php echo esc_attr( $term_limit ); ?>" data-return_id="id"
data-placeholder="<?php esc_attr_e( 'Select values', 'woocommerce' ); ?>"
data-orderby="<?php echo esc_attr( $attribute_orderby ); ?>"
class="multiselect attribute_values wc-taxonomy-term-search"
Expand Down