On a WordPress site with WooCommerce I use this function to query for the number of products in a category
$check_products = get_terms( array( 'taxonomy' => 'product_cat', 'include' => $element->object_id ) );
This is inside a menu_walker class to add the number of products to the category name in a menu-option, like this New Products (10)
. This site sells unique products, so after selling an item, the item is out of stock.
This works fine, but after installing WPML there is a difference in count. The site has a default language and a WPML translated version. When you buy something while using default language, the menu-option will show the correct adjusted number of products. Switch to the WPML translated version, and the number is unchanged (too high).
The same error happens when you buy something from the WPML translated version and then switch to the default language version.
How can the same function return a different value?
If already tried to clear/reset information in the Tools menu of WooCommerce but no luck yet.