Skip to content

Instantly share code, notes, and snippets.

@garvs
Created November 3, 2019 02:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garvs/b7b6463d69c2e198afbcca070c305120 to your computer and use it in GitHub Desktop.
Save garvs/b7b6463d69c2e198afbcca070c305120 to your computer and use it in GitHub Desktop.
Restrict Woocommerce reports tab
<?php
add_filter( 'woocommerce_admin_reports', 'restricts_wc_reports_tabs', 10, 1 );
function restricts_wc_reports_tabs( $reports ) {
if ( current_user_can( 'manage_woocommerce' ) ) {
// do not restrict WooCommerce admin
return $reports;
}
unset( $reports['orders'] );
unset( $reports['customers'] );
// unset( $reports['stock'] );
unset( $reports['taxes'] );
return $reports;
}
// end of restricts_wc_reports_tabs()
@garvs
Copy link
Author

garvs commented Nov 3, 2019

The recipe is used at this article.

@WebDesigner1234
Copy link

Hello is this still working? I tried with woocommerce 3.6.2 but it didn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment