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

Hide empty terms is not working properly

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.

Hello, i have husky version  3.3.4.4 and my problem is that even though i have hide empty terms enabled when i get to a product category, tag, brand etc page it doesnt work correctly. I have to reload a page and then it works. Then if i move to another product category page for example it stores the terms from the previous page. If i reload then it works fine

I added purchase code and wp password and username to private data

Hello

Please  drop  me  a  link to  your  site

Perhaps your theme uses ajax navigation

https://nlf.gr/ this is the link to my site. if you want to see the problem you can check this page https://nlf.gr/brand/gb-titanium/ and how filters change AFTER reload

Did you find anything?

Hello

Ok! Can  I disable  plugins/theme  to test?

No problem, but you will enable them again ok?

Hello

I installed another theme, everything works correctly.

Perhaps in the current theme queried object is not defined correctly

The theme that i use is an underscrore-like theme from https://fullsiteediting.com/. Is is possible that husky doesnt work well with block themes?

Yes thats the problem i tested it out. I used the twenty-twenty one theme which is not a block theme and the filters worked fine. Then i used twenty twenty three theme which is made with full site editing (block theme) and it had the same issue as the current theme. You have to find a way to make it work for block themes as well. Can you check it out please?

Hello, any update on the issue?

Hello

Yes, you are right

We have a hot fix for this: in  file - wp-content\plugins\woocommerce-products-filter\index.php - add  code - https://share.pluginus.net/image/i20231027101509.png

        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();
            }
        } else {
            if ($this->is_really_current_term_exists()) {
                $this->set_really_current_term();
            }
        }

The code fixed the issue a little bit but not completely. i have the following problems.  Lets say i go to this product category https://nlf.gr/product-category/analosima-axesouar-2/metrotainies/. It has brands(Εταιρίες ) and categories(Κατηγορίες) as filters. If i reload the page the categories dissapear and only the brands remain. After that if i go to the shop page https://nlf.gr/shop/ first of all the price filter is not displayed. Also the categories filter is not showing. I if i refresh then both the price and the categories filter show up. Now lets say i go this brands page https://nlf.gr/brand/gb-titanium/. It shows the correct filters but it adds the brand filter as well. When i reload the page the brand filter is not there which is okay i guess because there is only one brand. But then if i go to shop again something very weird happens, the categories filter is showing this time but the brand filter is gone as well as the price filter. I have to reload the page to see the price filter and the brands filter. So as i understand it if i go from a category back to shop then the filter for categories is gone, if i go from a brand back to shop then the filter for the brands is gone. Can you please fix this?

Hello

Do you have  a test site? Can you drop me wp-admin+ ftp access to your test site  - https://share.pluginus.net/image/i20230222134241.png ->https://share.pluginus.net/image/i20230222134615.png

Yes i have a test site, i will add the passwords for wp-admin and ftp to the private data. When you connect with the ftp in the root directory open nlf.metakomhsh.gr. I didnt add your code to the test site, let me know if you want me to do it.

Hello

OK!  Please  deleet  this   code - https://share.pluginus.net/image/i20231101122133.png

In  file - \wp-content\plugins\woocommerce-products-filter\index.php - add  code - https://share.pluginus.net/image/i20231101122431.png

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();
}
} else {
if ($this->is_really_current_term_exists()) {
$this->set_really_current_term();
}
}
if ($this->current_page_term) {
// return $this->current_page_term;
}

Your code makes the server to throw a 503 error. Even the test site i gave you has this error. I tried it to nlf.gr and it throws 503 error.

Hello

Please  do a test

I changed  the  code:

            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();
                }
            }

 

Perfect from what i see it works. Thank you! One final question though. What will happen if i update the plugin. Will you include this change to the update? Or i will have to add the code manually every time you update the plugin

Hello

We will include this fix in a new version of the plugin