Hello! I made my taxonomy for woocommerce products and now I am thinking how to organize a filter for it. Tell me please.

    1 answer 1

    For example, if filters are written with all pens, then + another field with taxonomy and selection via hook

    add_action( 'pre_get_posts', 'action_function_name' ); function action_function_name( $query ) { if ( !is_admin() && is_shop() && $query->is_main_query() && !empty(get_query_var('people')) ){ $query->set('tax_query', array( array( 'taxonomy' => 'people', 'field' => 'slug', 'terms' => get_query_var('people') ) ) ); } } 

    Or try the plugin WooCommerce Products Filter