Right here is my handler to ajax request. What’s my downside?
operate loadmore_ajax_handler(){
$args = [];
$args['paged'] = $_POST['page'];
$args['posts_per_page'] = 3;
$args['post_type'] = 'product';
query_posts($args);
$response = [];
whereas( have_posts() ): the_post();
$product = wc_get_product(get_the_ID());
$response[] = '
<div class="catalog-goods-wrapper--card">
<img src="' . get_the_post_thumbnail_url() .'" alt="footwear" class="catalog-goods--good-preview" />
<div class="catalog-goods-wrapper--overlay"></div>
</div>
<p class="catalog-goods--description">' . get_the_title() . '</p>
<span class="catalog-goods--price">' . $product->get_price_html() . '</span>
<i class="view-good"></i>';
endwhile;
wp_reset_query();
echo json_encode($response);
die;
}