very good question! i was also wondering if there is any hook to have new products become virtual by default? now i have to tick the checkbox for every new product and/Or its variantions which is very time-consuming!
only dirty solution if found:
open ~/wp-content/plugins/woocommerce/includes/admin/meta-boxes/views/html-variation-admin.php
and change line 239 from:
<label><input type="checkbox" class="checkbox variable_is_virtual" name="variable_is_virtual[<?php echo $loop; ?>]" <?php checked( isset( $_virtual ) ? $_virtual : '', 'yes' ); ?> /> <?php _e( 'Virtual', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Enable this option if a product is not shipped or there is no shipping cost', 'woocommerce' ); ?>" href="#">[?]</a></label>
to
<label><input type="checkbox" class="checkbox variable_is_virtual" name="variable_is_virtual[<?php echo $loop; ?>]" <?php checked( isset( $_virtual ) ? $_virtual : 'yes', 'yes' ); ?> /> <?php _e( 'Virtual', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Enable this option if a product is not shipped or there is no shipping cost', 'woocommerce' ); ?>" href="#">[?]</a></label>
this is the only change:
<?php checked( isset( $_virtual ) ? $_virtual : 'yes', 'yes' ); ?> />
my quick fix is for variable products. if you have a simple product, then you can use this filter in your functions.php
function cs_wc_product_type_options( $product_type_options ) {
$product_type_options['virtual']['default'] = 'yes';
$product_type_options['downloadable']['default'] = 'yes';
return $product_type_options;
}
add_filter( 'product_type_options', 'cs_wc_product_type_options' );