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

[woof taxonomies=product_cat:1293] not showing any filters - 0 products

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.

HI

Is there some other setting to get this to work please?

[woof taxonomies=product_cat:1293]

All the filters are empty, 0 products.

For info, we have added this shortcode to another category page that does not have products under it. Could it be that it ignores this on a category page? Because when on a category page that does have products, the filter works for that category, and seems to ignore the taxonomies attribute.

The setting"Set filter automatically" = No does not work either. Or yes.

I have show count=Yes, dynamic recount=Yes, but Hide empty terms = No because I cant change it (free version?). But should not matter as they are all 0 anyway.

Thanks

You can see the empty filters here https://www.cutlery.uk.com/brands/david-mellor-cutlery/, whereas I have tried categories with products in it with these attributes set. For example, many of them have"Wood Handle" selected for them, but its 0 when using the shortcode.

Hello

I checked  your page

Looks like you are using this incorrect shortcode:

[woof taxonomies='product_cat:david-mellor-cutlery,david-mellor-stainless-steel,david-mellor-silver-plate,david-mellor-steak-and-cheese-knives']

Are you sure that these attributes are not empty. Give me a screenshot of the attribute settings. An exampe -/wp-admin/edit-tags.php?taxonomy=styles&post_type=product

Did you enable caching in the filter settings? - https://share.pluginus.net/image/i20220817083028.png - if  yes, please, disable  it

Thanks for your reply.

I disabled the cache terms and cache dynamic recount but still same issue.

Let's use this product as an example,"Black Handle Steak Knife": https://www.cutlery.uk.com/cutlery/cheese-and-steak-knives/black-handled-cheese-knifedavid-mellor-black-handle-cheese-knife-13-5/

Here is a screen shot of the attributes selected for the product https://ibb.co/zP9tqJc

It is in category"Cheese and Steak Knives" here https://www.cutlery.uk.com/cutlery/cheese-and-steak-knives/, which has category ID 1309

If I use both these shortcodes, it displays all attributes with 0 products.

[woof taxonomies=product_cat:1309]
[woof taxonomies=product_cat:cheese-and-steak-knives]

As stated when on a category page [woof] seems to ignore the taxonomies attribute, because the code [woof taxonomies=product_cat:1309] does show the attributes with products OK but only for the category you are in, and not for 1309. Here is a test category that does have products below it https://www.cutlery.uk.com/cutlery-test/, and its showing the correct products and ignoring taxonomies=product_cat:1309 or taxonomies=product_cat:cheese-and-steak-knives (I have hard coded this ID as a test)

Thanks

https://www.cutlery.uk.com/cutlery/cheese-and-steak-knives/ - No! it is  1316

So try:

[woof taxonomies=product_cat:1316]

Sorry 1309 was the empty brands category! Tried my best to be detailed and copied wrong ID!

BUT it still does not work with 1316. I have used correct IDs trying all this out before posting. My code actually fetches the IDs automatically based on a custom field we have to choose the categories to show, so correct IDs have been used even though I made a copy and paste error above!

So still does not work with this:
[woof taxonomies=product_cat:1316]

Thanks

I'm not sure what you want to get from the filter

Can you explain in more detail what page you want to get?

Check  option -> Advanced->Options-https://c2n.me/4gpmWdh.png

Please create  a  custom  page  with  shortcodes:

[woof taxonomies=product_cat:1734]

[woof_products taxonomies=product_cat:1734]

and  drop me  exact  link

 

What we are trying to get from the filter, is to show the filter and products for a category, but on a different category"page". Your shortcode implies it does that. BUT its not actually a"page" we are showing it on. It's another product category. This product category does not have any products in it. So we are using your code to get the filter and products from other categories.

What I have done is create a test page using my IDs that I am using on the category, so we can compare.

The test page is working fine:
https://www.cutlery.uk.com/woof-test/

But the exact same shortcodes on the category page all show 0:
https://www.cutlery.uk.com/brands/david-mellor-cutlery/

[woof taxonomies=product_cat:1316]

[woof_products taxonomies=product_cat:1316]

My hunch is, because we are on a category page, your code is getting the category ID of the category page we are on, and ignoring the taxonomies attribute we are passing. Because it works on a normal page, but is not working on a category page.

Thanks

 

Hello

And since I see: On category page  1309  (https://www.cutlery.uk.com/brands/david-mellor-cutlery/) - you want to show a filter for a category - 1316. Did I understand correctly?

 and ignoring the taxonomies attribute we are passing - Yes, when recalculating terms dynamically, the current category overwrites the shortcode attribute (only if it's the same taxonomy).

If you want to show a filter for multiple categories : [woof taxonomies=product_cat:1316,1309]

Yes thats correct

Disabling"Dynamic recount" shows ALL products and filters on the category page, so that does not work.

So is there a solution? I dont think WOOF should ever override the taxonomies when then taxonomies attribute is set, even if on a category page.

Ok!  In file - wp-content\plugins\woocommerce-products-filter\index.php - delete  this  code - https://share.pluginus.net/image/i20220818095526.png

ok thank you will try it. But dies that mean I should never update your plugin? It will overwrite this otherwise.

Hello

Unfortunately yes.

it is possible to do this with a hook - woof_dynamic_count_attr - https://share.pluginus.net/image/i20220819082707.png

Your link to the hook meant I could created this function and it seems to be working well! So thanks a lot.

The hook allows me to add in extra taxonomies into the WOOF function. I dont even need to use the taxonomies attribute. All I need to do is check if the additional categories are selected within the category page (via a custom field) and then add these into the WOOF query. It seems to work but will double check with customer it shows the right data:

function my_woof_dynamic_count_attr($args, $custom_type)
{
    // Get additional categories from custom field
    $additional_categories = get_field('additional_subcategories');

    // Add additional categories slug to WOOF tax query if exists
    if($additional_categories)
    {
        foreach ($additional_categories as $additional_cat)
        {
            $args['tax_query'][0]['terms'][] = $additional_cat['category']->slug;
        }
    }
    return $args;
}
add_filter('woof_dynamic_count_attr', 'my_woof_dynamic_count_attr', 999, 2);

 

I do still think your plugin should only use the current category IF the taxonomies attribute does not exist. The taxonomies attribute should take priority over the category ID. If someone passes taxonomies to [WOOF] then it means they want to show those, regardless of the page they are on.

Thanks!

Hello

Great!

I do still think your plugin should only use the current category - I will pass this  to the developers

Welcome;)