• Hello!

    I want my tax advisor to have access to my woocommerce orders but not the settings pages… so basically I have to override the disableing of the admin bar for her. to do that I tried to override this function in my child templates function.php file like this:

    if ( ! function_exists( 'wc_disable_admin_bar' ) ) {
    
    	  function wc_disable_admin_bar( $show_admin_bar ) {
    		 if ( apply_filters( 'woocommerce_disable_admin_bar',
                     get_option( 'woocommerce_lock_down_admin', 'yes' ) ===
                     'yes' ) && ! (
    current_user_can('view_woocommerce_reports') ||
    current_user_can( 'edit_posts' ) ||
    current_user_can( 'manage_woocommerce' ) ) ) {
    		  $show_admin_bar = false;
    		  }
    
    		  return $show_admin_bar;
    	  }
    	  add_filter( 'show_admin_bar', 'wc_disable_admin_bar', 10, 1 );
    }

    Sadly this seems to be ignored.

    Any help?

    thx, piedro

    https://ww.wp.xz.cn/plugins/woocommerce/

The topic ‘Override the wc_disable_admin_bar function?’ is closed to new replies.