skip archive query and add tax to a term page in bricks

<?php
/**
 ** skips detecting main query archive query
 **/
add_filter( 'facetwp_is_main_query', function( $is_main_query, $query ) {
    if ( $query->is_archive() && $query->is_main_query() ) {
      $is_main_query = false;
    }
    return $is_main_query;
  }, 10, 2 );


/** replace 'fyjhnq' in ln 18 with the element id in your template
 ** see https://facetwp.com/help-center/using-facetwp-with/bricks/#usage-products-element
 ** for how to find the element id
 **/
add_filter( 'bricks/posts/query_vars', function( $query_vars, $settings, $element_id ) {
    if ( 'fyjhnq' == $element_id ) {

        global $query_offset;
        global $query_counter;

        $main_query = $GLOBALS['wp_the_query'];

        if ( ! isset( $query_offset ) ) {
            $query_offset = 1;
            if ( 'product_query' == $main_query->get( 'wc_query' ) ) $query_offset++;
        }
        $query_counter = ( ! isset( $query_counter ) ) ? 0 : $query_counter;

        $is_correct_query = ( $query_offset === $query_counter ) ? true : false;
        $query_counter++;

        $query_vars['facetwp'] = $is_correct_query;

        if ( $is_correct_query && ! isset( $settings["query"]["disable_query_merge"] ) ) {

            if ( $main_query->is_archive || $main_query->is_search ) {
                if ( $main_query->is_category ) {
                    $query_vars['cat'] = $main_query->get( 'cat' );
                }
                elseif ( $main_query->is_tag ) {
                    $query_vars['tag_id'] = $main_query->get( 'tag_id' );
                }
                elseif ( $main_query->is_tax ) {
                    $query_vars['taxonomy'] = $main_query->get( 'taxonomy' );
                    $query_vars['term'] = $main_query->get( 'term' );
                }
                elseif ( $main_query->is_search ) {
                    $query_vars['s'] = $main_query->get( 's' );
                }
            }
        }
    }

    return $query_vars;
}, 10, 3 );