PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Product counts are wrong on first load or after site cache is cleared.

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

I have installed the Products Filter plugin on a wp site running at wpengine.com.  When displaying products via a product tag, the initial load shows counts for all products not just those that have the product tag.  If I refresh the page, the counts are correct.  The counts remain correct until the cache resets (or I clear it using the wpengine.com portal).  If I go to the Products Filter settings and click the"Save changes" button, the counts will be wrong again for the next load.  Then correct on a subsequent load.

I have Dynamic recount set to"yes".  I have all the cache settings disabled in the Products Filter settings and I have added a cache exclusion for the product tag url (^/products./*).  However, the behavior is still there.  Unfortunately, wpengine.com does not allow for disabling the cache for the entire site to prove the cache is causing the issue.  Below are screenshots for clarity

 

First Load:
First load

Second load:
Second load

I just realized that if I navigate away from the page (ie. click on a product to show the product detail page) and then return, the counts are wrong again.

Hello

What plugin version number are you using?

you can try in file - \wp-content\plugins\woocommerce-products-filter\index.php - add this code - https://share.pluginus.net/image/i20231201114513.png

if (wc_current_theme_is_fse_theme()) {
if (!defined('DOING_AJAX') && !is_page()) {
global $wp_query;
$queried_obj = get_queried_object();
if (isset($wp_query->query_vars['taxonomy']) and is_object($queried_obj) and get_class(get_queried_object()) == 'WP_Term' and !isset($request_data['really_curr_tax'])) {
if (is_object($queried_obj)) {
$this->set_really_current_term($queried_obj);
}
} elseif (isset($request_data['really_curr_tax'])) {
$tmp = explode('-', $request_data['really_curr_tax'], 2);
$res = get_term($tmp[0], $tmp[1]);
$this->set_really_current_term($res);
} else {
$this->set_really_current_term();
}
}
}
and  do a test

 

Thanks for the reply!

made the change (screenshot below), but still seeing the same behavior.

FYI...we are using Breakdance (breakdance.com) with the wordpress theme disabled (default settings for breakdance).

Site:
https://weirswoocom.wpenginepowered.com/products./all-country-store/

index.php changed

I droped the"if (wc_current_theme_is_fse_theme())" statement and it's working now (screenshot below).
Thank you so much!  Will I need to"reapply" this fix after every update?

Hello

Ok!  Can you try  to use this  function wp_is_block_theme()  instead of  wc_current_theme_is_fse_theme() ?  just for the test

wrapping the code with"if (wp_is_block_theme())" did not work.  I'm guessing this is due to us using breakdance with WP theme disabled.

 

Hello

Unfortunately in this case you have to make these changes every time you update the filter