Home Forums WoodMart support forum product display failure Reply To: product display failure

#343591

Optica Valls
Participant

When there are products out of stock, please leave a blank space.

You can see this bug on the home page, but it also happens in the store. To correct it, I am forced to put the following in functions:

function show_only_instock_products ($ query) {
$ meta_query = $ query-> get (‘meta_query’);
$ meta_query [] = array (
‘key’ => ‘_stock_status’,
‘compare’ => ‘=’,
‘value’ => ‘instock’
);
$ query-> set (‘meta_query’, $ meta_query);
}
add_action (‘woocommerce_product_query’, ‘show_only_instock_products’);

But this obviously slows down the load and should not occur.

Attachments:
You must be logged in to view attached files.