I have code like this for fetching and displaying products in woocommerce:
{
$args = array(
'post_type' => 'product',
'posts_per_page' => 30
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) : $loop->the_post();
//display results here;
endwhile;
}
The problem is while the code displays 30 products at a time as specified, it does not add page links so other products could be viewed, is there a way to do this or am I missing somethin?
Can you please check below code? i hope this code is work for you.
Reference : Pagination in WooCommerce