How to Fix Duplicate WooCommerce Product Showing up on Page

duplicate woocommerce product showing up on page mainOne of the most common problems in WooCommerce is duplicate WooCommerce product showing up on page. If you are running into this problem, I want to show you the possible causes of this issue and how you can easily fix it without wasting all your time.

To understand why duplicate WooCommerce product showing up on page occurs you need to first understand how WooCommerce products are displayed on the home page or on any other page.

I want to begin by showing you how you can display WooCommerce products.

WooCommerce Products Display

WooCommerce products are displayed using a loop and this can be illustrated using the code below that has been added to the custom page template and you can see the display of the products in the image below :
duplicate woocommerce product showing up on page
For these products to be displayed on this page, I have created a custom page template and added the loop that queries the WooCommere products and displays them as in the cide below:

[php] <?php
/**
* Template Name: Testing Page
*
* @package WordPress
*/
get_header();

$args = array(
‘post_type’ => ‘product’,
‘posts_per_page’ => 4,
);?>
<div class="test-loop">
<?php

$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
global $product;
?>

<div class="test-loop-item">
<a href="<?php the_permalink(); ?>" id="id-<?php the_id(); ?>" title="<?php the_title(); ?>">

<?php if (has_post_thumbnail( $loop->post->ID ))
echo get_the_post_thumbnail($loop->post->ID, ‘shop_catalog’);
else echo ‘<img src="’.woocommerce_placeholder_img_src().’" alt="product placeholder Image" width="65px" height="115px" />’; ?>

<h3>
<?php the_title(); ?>
</h3>
</a>
</div>

<?php
endwhile;
wp_reset_query(); ?>

</div>

<?php get_footer(); ?>

[/php]

Duplicate WooCommerce Product Showing up on Page

We can recreate this problem of duplicate WooCommerce product showing up on page by repeating the loop that displays the products on the page. This is the cause of the problem of WooCommerce product showing up on page.

There are several cases that can lead to this issue, the most common cause in my experience is a translation plugin that recreates the product in a different language.

duplicate woocommerce product showing up on page

The second most common cause of this problem is the plugin that uses the loop to display products. The best way to fix this problem is to remove all the plugins and reactivate them one by one checking which one is causing the issue.

The second cause of this issue is a theme that has some loop code that is added to the page especially on the footer or header and this can use tested by creating a custom page template and testing to see if the duplicate products are displayed on the blank custom page template.

Conclusion

In this post we have looked at how to fix duplicate WooCommerce product showing up on page, ideally, you want to figure out what is causing the loop that displays the WooCommerce products on the page to be repeated.

Similar Articles