Figured this out now.
Instead of using $wp_query->set(), I instead set arguments, and then ran the woocommerce loop. This is the final code I used.
add_action('wp_ajax_listFilteredProducts', 'listFilteredProducts');
add_action('wp_ajax_nopriv_listFilteredProducts', 'listFilteredProducts');
function listFilteredProducts($wp_query) {
if(isset($_GET['formData'])) {
$value = $_GET['formData'];
}
// If no price input, but tags have been input
if ($value['priceRange'] == 0 && $value['tags'] != 0) {
$args = array(
'post_type' => 'product',
'posts_per_page' => -1,
'tax_query' => array(
'relation' => 'OR',
array(
'taxonomy' => 'product_tag',
'field' => 'slug',
'terms' => $value['tags'],
),
array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => $value['tags'],
),
array(
'taxonomy' => 'pa_branding',
'field' => 'slug',
'terms' => $value['tags'],
),
)
);
//If price has been input, but no tags have been input
} else if ($value['priceRange'] != 0 && $value['tags'] == 0) {
$args = array(
'post_status' => 'publish',
'post_type' => 'product',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => '_price',
'value' => array($value["priceRange"][0], $value["priceRange"][1]),
'compare' => 'BETWEEN',
'type' => 'NUMERIC'
)
)
);
//if neither price or tags input
} else if ($value['priceRange'] == 0 && $value['tags'] == 0) {
if(!$value['priceRange']) {
$value['priceRange'] = array(0,1000000);
}
$args = array(
'post_type' => 'product',
'posts_per_page' => -1,
);
// if tags and price input
} else if($value['priceRange'] && $value['tags']) {
$args = array(
'post_type' => 'product',
'posts_per_page' => -1,
'tax_query' => array(
'relation' => 'OR',
array(
'taxonomy' => 'product_tag',
'field' => 'slug',
'terms' => $value['tags'],
),
array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => $value['tags'],
),
array(
'taxonomy' => 'pa_branding',
'field' => 'slug',
'terms' => $value['tags'],
),
),
'meta_query' => array(
'relation' => 'AND',
array(
'key' => '_price',
'value' => array($value["priceRange"][0], $value["priceRange"][1]),
'compare' => 'BETWEEN',
'type' => 'NUMERIC'
)
),
);
}
$ajaxposts = new WP_Query( $args );
$response="";
if ( $ajaxposts->posts ){
while ( $ajaxposts->have_posts() ) {
$ajaxposts->the_post();
$response .= wc_get_template_part( 'content', 'product' ); // use WooCommerce function to get html
}
} else {
// handle not found by yourself or
// perhaps do_action( 'woocommerce_no_products_found' ); could do the trick?
}
echo $response;
exit;
wp_die();
}