enable the virtual option in variable products
-
Hello, i try to enable the virtual option to be checked to all variable products.
I try to use the following snippet but not working:
add_action( ‘woocommerce_product_options_general_product_data’, ‘enable_virtual_option’ );
function enable_virtual_option(){
global $post, $woocommerce, $product, $product_object;
if ( $product_object->is_type(‘variable’) ){
?>
<script>
(function($){
$(‘input[name=_virtual]’).prop(‘checked’, true);
})(jQuery);
</script>
<?php
}
}
Can you suggest me a solution please?
Thanks!
Hello,
This code would not fit the variable product.
Unfortunately, we do not have a solution to implement your purpose.
Best Regards