Hi there
that’s really strange, since count that comes from count_all_products() method isn’t affected in any way by product loop; it simply counts items stored in wishlist table for current user
I tried to add the same method in the header of my test site, and I was able to consistently see wishlist count across all pages of my site
Could this be a cache problem? Maybe you’re viewing wishlist count for another user that happened to be stored in page cache?
Hi and thanks for your response.
Im querying my items with a custom template and wc_get_products() instead of choosing my page in woocommerce shop-page settings. If I use the page-settings the counter works. Maybe you could test again with an custom product-query?
Hi there
sure, but I’m afraid the result won’t change (as I said, I double checked the code and I cannot find any evidence that product query would affect wishlist items count)
Anyway, here you go: I created a page containing [products] shortcode (it will retrieve products using custom WP_Query, as you can see here: wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-products.php:572)
This is page configuration, and this is the page appearance
As you can see im the header, count matches the number of wishlist items, and isn’t affected by how many products I show in the page
Besides, there is the fact that ->count_all_products() method always returns an integer, and never prints formtted text
Unfortunately I don’t know what is happening on your installation, but I have the feeling this is something outside of plugin code
Hey,
thanks again for your reply. In the meantime I found the problem. I had two elements with class “counter” in my theme. One for the items on my wishlist and the other I used for filtering products to show the amount after filter-action. This of course also wrote the numbers in my wishlist-counter element. Im so sorry that I wasted your time just because I was too stupid to give proper classes.
Thanks anyway for your great support.
Hi again
don’t worry, it is a pleasure for us to help 😉
And by the way, thank you for your effort on supporting other people of the community, we really appreciate it 🙂
May I aslo ask you to review our plugin? A good review would really help us, and support our work