Created
March 8, 2020 14:53
-
-
Save ckaklamanos/490619d1003ef55d3cb0bb5ec91aab2e to your computer and use it in GitHub Desktop.
WooCommerce - Remove Virtual and Downloadable Checkboxes from the Product Data Metabox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function fn_woocommerce_remove_virtual_and_downloadable_checkboxes( $options ) { | |
// remove "Virtual" checkbox | |
if( isset( $options[ 'virtual' ] ) ) { | |
unset( $options[ 'virtual' ] ); | |
} | |
// remove "Downloadable" checkbox | |
if( isset( $options[ 'downloadable' ] ) ) { | |
unset( $options[ 'downloadable' ] ); | |
} | |
return $options; | |
} | |
if (!current_user_can('manage_options')) { | |
add_filter( 'product_type_options', 'fn_woocommerce_remove_virtual_and_downloadable_checkboxes'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment