Add this to your functions files to grey out ‘out of stock’ products in WooCommerce
//grey out out of stock products
function grey_out_variations_when_out_of_stock( $grey_out, $variation ) {
if ( ! $variation->is_in_stock() )
return false;
return true;
}
this only seems to work for products with variations.
how about a product which has no variations… and following settings:
backorders ‘notify’
stock level ‘0’
stock status ‘in stock’
I can’t seem to find code for this anywhere online.. I don’t understand php myself.
I want to show my full product catalogue as I will make all items to order.. some I have in stock ready to ship, some i have to make to order.. I want the make to order items to be greyed out so people can see quickly the difference.
thank you in advance if you are able to help me đŸ™‚
Where add the code from wordpress?
$grey_out
just add the code above to the functions.php file in your child theme.