Wednesday, 20 March 2023 14:47
How to change tag count limit in woocommerce widget?
Open function.php and add this code:
// change counts at blog pages
add_filter('widget_tag_cloud_args', 'tag_widget_limit');
function tag_widget_limit($args){
if(isset($args['taxonomy']) && $args['taxonomy'] == 'post_tag'){
$args['number'] = 300; //Limit number of tags
}
return $args;
}
// change counts in Woocomerce
function custom_woocommerce_tag_cloud_widget() {
$args = array(
'number' => 500,
'taxonomy' => 'product_tag'
);
return $args;
}
add_filter( 'woocommerce_product_tag_cloud_widget_args', 'custom_woocommerce_tag_cloud_widget' );