Answer the question
In order to leave comments, you need to log in
Woocommerce pagination not working?
Hello. I display products from Woocommerce via WP_Query (), the design is as follows:
$category = get_queried_object();
$paged = ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1;
$args = array(
'post_type' => 'product',
'paged' => $paged,
$category->taxonomy => $category->slug,
);
$posts = new WP_Query($args);
if($posts->have_posts()):
while($posts->have_posts()): $posts->the_post();
get_template_part( 'templates/content/product-cat', 'product-cat' );
endwhile;
wp_reset_postdata();
endif;
if(have_posts()):
while(have_posts()): the_post();
get_template_part( 'templates/content/product-cat', 'product-cat' );
endwhile;
wp_reset_postdata();
endif;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question