Add a filter `woocommerce_admin_terms_metabox_datalimit` to change the 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>
This commit is contained in:
Leif Singer 2024-03-12 14:22:48 +01:00 committed by GitHub
parent 88f1187928
commit 15855b55a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Add a filter to adjust the 50 terms limitation in the product edit page.

View File

@ -37,10 +37,17 @@ if ( ! defined( 'ABSPATH' ) ) {
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"