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

Pre-Sale Question: ¿can the plugin recount correctly with a custom product meta filter?

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,

I use the WOOF free plugin and I want to buy the premium version, but I need to know if the plugin can recount correctly the items with a custom product meta filter. I use the next PHP code in functions.php to do the filter in all store:

function filter_woocommerce_product_query_meta_query( $meta_query, $instance ) {
$meta_query[] = array(
'key' => 'internet_active',
'value' => '1',
'compare' => '='
);
return $meta_query;   };
add_filter( 'woocommerce_product_query_meta_query', 'filter_woocommerce_product_query_meta_query', 10, 2 );

But the WOOF plugin doesn't count correctly the items on category filter, and it's showing the normal count without apply the filter, showing, for example, empty categories.

¿Is this possible or there is a way to do that correctly?

Thanks!

Hello

Use  this  hook  to add  your query - woof_dynamic_count_attr - https://share.pluginus.net/image/i20210712142156.png

I did a filter right this:

function filter_woocommerce_product_query_woof($args){
$args['meta_query'][] = array(
'key' => 'activo_internet',
'value' => '1',
'compare' => '='
);
return $args;
}
add_filter('woof_dynamic_count_attr', 'filter_woocommerce_product_query_woof')

 

But it doesn't work.. ¿can you help me with the filter? Thanks!

 

Thanks!

Hello

You should hire a developer to write the correct code.

Your custom code has errors. Check carefully the number of variables

Unfortunately, customization of the code is not included in the support

Ok no problem. Thanks. Finally, I solved It. I paste the code here for if anyone need it:

 

function filter_woocommerce_product_query_woof($args, $custom_type){
$args['meta_query'][] = array(
'key' => 'activo_internet',
'value' => '1',
'compare' => '='
);
return $args;
}
add_filter('woof_dynamic_count_attr', 'filter_woocommerce_product_query_woof', 10, 2)

Hello

Ok! Gracias