Quote from Kerry on May 30, 2020, 22:58
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
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