Convert product categories widget to use selectWoo.
This commit is contained in:
parent
e6c1ab38a8
commit
664abe2015
|
@ -201,6 +201,30 @@ function wc_product_dropdown_categories( $args = array() ) {
|
|||
$args['orderby'] = 'name';
|
||||
}
|
||||
|
||||
wp_enqueue_script( 'selectWoo' );
|
||||
wp_enqueue_style( 'select2' );
|
||||
|
||||
wc_enqueue_js(
|
||||
"
|
||||
if ( jQuery().selectWoo ) {
|
||||
var wc_product_cat_select = function() {
|
||||
jQuery( '.dropdown_product_cat' ).selectWoo( {
|
||||
placeholder: '" . esc_js( __( 'Select a category', 'woocommerce' ) ) . "',
|
||||
minimumResultsForSearch: 5,
|
||||
width: '100%',
|
||||
allowClear: true,
|
||||
language: {
|
||||
noResults: function() {
|
||||
return '" . esc_js( _x( 'No matches found', 'enhanced select', 'woocommerce' ) ) . "';
|
||||
}
|
||||
}
|
||||
} );
|
||||
};
|
||||
wc_product_cat_select();
|
||||
}
|
||||
"
|
||||
);
|
||||
|
||||
wp_dropdown_categories( $args );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue