Calling & display certain product category loop and pagination on the homepage

Need some help with wordpress and woocommerce functions.

OK, the situation is, I have a homepage that use archive-product.php template. It shows latest 28 products per page. This is the product loop code and pagination code that display it.

<?php if ( have_posts() ) : ?>

<?php if (woocommerce_products_will_display()): ?>
<div class=”filter-wrap”>
<div class=”filter-content”>
<?php
/**
* woocommerce_before_shop_loop hook
*
* @hooked woocommerce_result_count – 20
* @hooked woocommerce_catalog_ordering – 30
* @hooked et_grid_list_switcher – 35
*/
do_action( ‘woocommerce_before_shop_loop’ );
?>
</div>
</div>
<?php endif ?>

<?php woocommerce_product_loop_start(); ?>

<?php woocommerce_product_subcategories(); ?>

<?php while ( have_posts() ) : the_post(); ?>

<?php wc_get_template_part( ‘content’, ‘product’ ); ?>

<?php endwhile; // end of the loop. ?>

<?php woocommerce_product_loop_end(); ?>

<?php
/**
* woocommerce_after_shop_loop hook
*
* @hooked woocommerce_pagination – 10
*/
do_action( ‘woocommerce_after_shop_loop’ );
?>

Now, I want to display product certain product category also with pagination below the latest product. Currently I used product shortcode.

<div><?php echo do_shortcode(‘[product_category category=”new-watch-2″ per_page=”28″]’); ?></div>

But the thing is, it only shows 28 page and that all. No next page button.
So, I’m thinking of using the first code above, but this time maybe calling the category page-id 1st and grab its product loop & pagination.

Anyone know is it possible and how to call it?

Read more here:: Calling & display certain product category loop and pagination on the homepage

Leave a Reply

Your email address will not be published. Required fields are marked *