Hide variable products with 0.00

Hi, Is it possible to hide variable products with 0.00 with a code or to automatically set them to „out of stock“? With the simple products I did it with this code: add_action (‚woocommerce_product_query‘, ‚themelocation_product_query‘);
function themelocation_product_query ($ q) {
$ meta_query = $ q-> get (‚meta_query‘);
$ meta_query [] = array (
‚key‘ => ‚_price‘,
‚value‘ => 1,
‚compare‘ => ‚>‘
);
$ q-> set (‚meta_query‘, $ meta_query);
}

Many thanks for the help.