Home > Enterprise >  Hide downloadable product permission in WooCommerce order [closed]
Hide downloadable product permission in WooCommerce order [closed]

Time:10-01

According to this, How to disable downloadable product functionality in WooCommerce, I notice most of the solutions involving removing it. I just want to hide it in back end for shop manager when they log in.

I've tried this code below, but it does not hide the 'Downloadable product permission' in wp-admin

function CM_woocommerce_account_menu_items_callback($items) {
    unset( $items['downloads'] );
    return $items;
}
add_filter('woocommerce_account_menu_items', 'CM_woocommerce_account_menu_items_callback', 10, 1);

hide: https://snipboard.io/qmL9lw.jpg

CodePudding user response:

Try the below code -

function current_screen_product() {
    if ( function_exists('get_current_screen')) {  

        $pt = get_current_screen()->post_type;
        if ( $pt != 'product') return;
         $user = wp_get_current_user();
        if ( in_array( 'shop_manager', (array) $user->roles ) ) {
            remove_meta_box( 'your download permission div',$pt ,'normal' );               
        }
    }
}
add_action( 'current_screen', 'current_screen_product' );
  • Related