Product count incorrect on Shop page

The Product count on the Shop page is now 2xthe correct result. This would be a minor inconvenience but it also leads to incorrect pagination (half the number of product per page as the setting). See attached image, there are actually only 11 products in the Shop.

Assuming that this could be a bug due to the X Woocommerce Pagination template?

Category and Tag Archives show the correct number.

6.0.4 + WC 3.3.3

Hello There,

Thanks for writing in! I have tested in our local testing server and we could not replicate the issue. In our test servers, it is displaying exactly the same number of products. In your case, it is duplicated. Do you have some custom code that may have trigger the issue? Maybe a certain code is causing it. Or probably this could be caused by a 3rd party plugin. You could try testing for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.

If the issue still exist, please re install X theme and Cornerstone. There might be some files that were corrupted. You can review our update guide and see the Manual Update section to re install X.

And if still the issue exist, please provide us access so we can take a closer look and investigate the issue to be able to resolve this.

Please let us know how it goes.

OK, I’ll check. However the rest of the site (except X and WC) are the same so something seems to have happened with the X6/WC3.3 update. Did you test with WPML enabled, on my site I use a language switcher (not WPML though) so there kind of are 2x products if the different product language versions would be counted? Still there seems to be some difference in how “something” handles Category archives (correct) and Shop page (2x) so clearly the code to handle this differs somewhere.

Hello There,

I wasn’t able to test WooCommerce with WPML. I do not have that kind of set up in my local testing server. Could we check it in your site? Do you have a staging area where we can play around to figure out the culprit of this issue?

Kindly let us know.

Have been a bit busy, just responding to prevent the ticket from closing, will get back :slight_smile:

Hi,

Please let us know when ready.

Thanks

Now I did a test on the site and disable language translation (no effect) and as well as all other non-Woocommerce extensions and still seeing the issue.

Hello There,

Thanks for providing the information. I have logged in and checked your products in your dashboard. I can see that you have 26 published products and 22 out of 26 were being counted and only 13 products were displayed.

I have taken a closer look and it seems that you have filtered out some of the products not to be displayed in your shop page. You have added this code;

function custom_pre_get_posts_query( $q ) {

	if ( ! $q->is_main_query() ) return;
	if ( ! $q->is_post_type_archive() ) return;
	
	if ( ! is_admin() && is_shop() ) {

		$q->set( 'tax_query', array(array(
			'taxonomy' => 'product_cat',
			'field' => 'slug',
			'terms' => array( 'extras', 'maintenance', 'huoltopalvelut', 'merchandise' ), // Don't display products in the extras category on the shop page
			'operator' => 'NOT IN'
		)));
	
	}

	remove_action( 'pre_get_posts', 'custom_pre_get_posts_query' );

}

This code will not display any products under these terms: ‘extras’, ‘maintenance’, ‘huoltopalvelut’, ‘merchandise’.

This is the main reason why the count is different from what is being displayed. You may need to change the way the count has been displayed since you have change the number of product items displayed in your shop page. Since this is a WooCommerce customization, it is best that you consult this issue in WooCommerce support section. You can visit this page: https://docs.woocommerce.com/document/how-to-get-help/

Hope this helps.

Ah, OK, my bad. Thanks for the clarification, sorry for blaming you guys :-).

That’s not an issue and you are most welcome. :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.