Skip to content

Commit

Permalink
Add a filter woocommerce_admin_terms_metabox_datalimit to change th…
Browse files Browse the repository at this point in the history
…e data-limit value for the attributes term box (#45506)

* Update html-product-attribute-inner.php

Add a new filter `woocommerce_admin_terms_metabox_datalimit` to change the value of data-limit. See #37548 for more context.

* Update html-product-attribute-inner.php

* Creating a changelog file again

* update @SInCE tag

* tweak changelog file wording

---------

Co-authored-by: Saif H. Hassan <67080558+Babylon1999@users.noreply.github.com>
  • Loading branch information
2 people authored and Konamiman committed Mar 13, 2024
1 parent 4d69572 commit 6935b5e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
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
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

0 comments on commit 6935b5e

Please sign in to comment.