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

Removing "out of stock" items from dynamic count

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,

First, great plugin. It's so nice - I'm using premium version.

I have a catalog of products that have some items inventory controlled and many that are not. I do not want to show out of stock items in store, and this part works find based on settings and a function I found in documentation.

However, I have dynamic recount set and I show number of units in my filter, I found that the"out of stock items" were showing up in the count - but when you clicked the filter, they accurately did not show. So my issue is that the count was incorrect.

I was able to solve this with the following code, but I wanted to ask you if this is a good fix (that you can possibly implement if necessary) or if I just forgot some setting - and you can tell me what to do instead:

Manual change to woocommerce-products-filter/index.php Line 1746

if (version_compare(WOOCOMMERCE_VERSION, '3.0.8', '>=')) {
// $args = apply_filters('woocommerce_shortcode_products_query', $args, $atts, null);
//// bluejux add to exclude out of stock in count
$args['meta_query'][] = array(
'key' => '_stock_status',
'value' => 'outofstock', //instock,outofstock
'compare' => 'NOT IN'
);
/// end bluejux exclude out of stock in count
} else {
//$args = apply_filters('woocommerce_shortcode_products_query', $args, $atts);
}

Thanks,

Kerry

 

Hello Kerry

Please delete  all  your  code  changes

Check  option  please- Plugin settings->Advanced - https://c2n.me/47NegjO.png

Check extension - https://c2n.me/47Newgs.png - option - https://c2n.me/47NeEra.png

And  read  this - https://products-filter.com/manipulate-search-data-options/

Thank you! It worked, happy not to have to worry about code change :)

Hello

Welcome;)