Woocommerce product category customizations
Remove subcategory count.
add_filter( 'woocommerce_subcategory_count_html', function(){ return ''; });
Change the number of loop shop columns.
add_filter( 'loop_shop_columns', function(){ $cat_obj = get_queried_object(); $cat_id = $cat_obj->term_id; if( get_woocommerce_term_meta( $cat_id, 'display_type', true )== 'subcategories' ){ return 3; }else{ return 4; } });
Change the number of loop shop columns css. Just add a class on the body tag.
add_filter( 'body_class', function ( $classes ){ $cat_obj = get_queried_object(); $cat_id = $cat_obj->term_id; if( is_woocommerce() && ( get_woocommerce_term_meta( $cat_id, 'display_type', true )== 'subcategories' ) ){ $classes[] = 'columns-3'; }else{ $classes[] = ''; } return $classes; });