Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    You will have to adjust the loop that the code generates for the homepage, you can use something like this in the template file

        <ul class="products">
            <?php
            global $paged;
    
                $paged = ( get_query_var('page') ) ? get_query_var('page') : 1;
                $args = array(
                    'post_type' => 'product',
                    'posts_per_page' => 4,
                    'paged' => $paged
    
                    );
                $loop = new WP_Query( $args );
                if ( $loop->have_posts() ) {
                    while ( $loop->have_posts() ) : $loop->the_post();
                        woocommerce_get_template_part( 'content', 'product' );
                    endwhile;
                } else {
                    echo __( 'No products found' );
                }
            ?>
    
        <nav>
            <ul>
                <li><?php previous_posts_link( '&laquo; PREV', $loop->max_num_pages) ?></li> 
                <li><?php next_posts_link( 'NEXT &raquo;', $loop->max_num_pages) ?></li>
            </ul>
        </nav>
    
        <?php wp_reset_postdata(); ?>
        </ul><!--/.products-->

    We haven’t heard back from you in a while, so I’m going to mark this as resolved. Feel free to start a new thread if you have any further questions!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How could i add pagination on my home page for woocommerce’ is closed to new replies.