Hello.
We have some discontinued products which have a meta tag of “_discontinued-product”. When these values are set (to anything), we want to exclude it from the shop loop.
We have tried this by modifying our functions.php file with variations of this entry:
function remove_discontinued_4(){
if( ! is_shop() ) return $meta_query;
$meta_query[] = array(
'key' => '_discontinue_product',
'compare' => 'NOT EXISTS'
);
return $meta_query;
}
add_filter( 'woocommerce_product_query_meta_query', 'remove_discontinued_4', 10, 2 );
This WORKS, but we have alot of products (around 2000) plus variations – so this becomes VERY VERY slow, adding about 30 full seconds to the page load time, which is unacceptable for the user experience.
Is there a way to do this through woodmart that I’ve missed? Or perhaps you have a suggestion on how to achieve this without such a huge lag?
Thanks in advance!
~S