Hide ‘Downloadable’ and ‘Virtual’ checkbox options from Variations?

I am trying hide / unset the ‘Downloadable’ and ‘Virtual’ checkbox options from Woocommerce entirely. I have managed to unset them everywhere EXCEPT in the Woocommerce Variations Panel.

Looking in the Woocommerce plugin files I can see an action hook called ‘woocommerce_variation_options’ which seems to spit out the options for these checkboxes. I can obviously do a “dirty” injection of CSS here but whats the correct method to unset these checkboxes in the variations product panel?

I am looking for something like this:

add_action( 'woocommerce_variation_options', 'my_customize_variation_fields_func', 10, 3 );
function my_customize_variation_fields_func( $loop, $variation_data, $variation ){  
// Remove / Unset "Virtual" checkbox
// Remove / Unset "Downloadable" checkbox
}

I have tried using unset( $variation[ 'virtual' ] ); here but does not work as it has in another filter hook (product_type_options)? Any help / advice appreciated 🙂

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer