Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ckaklamanos/490619d1003ef55d3cb0bb5ec91aab2e to your computer and use it in GitHub Desktop.
Save ckaklamanos/490619d1003ef55d3cb0bb5ec91aab2e to your computer and use it in GitHub Desktop.
WooCommerce - Remove Virtual and Downloadable Checkboxes from the Product Data Metabox
<?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