Hi @davidcova,
Thank you for finding that support ticket for me – when I saw the subject of your support ticket I remembered that one and was going to go find it.
The first thing we need to know is the slug of your additional tabs. If your tab is called “Description” the slug will be description
; likewise if it’s called Additional Information the slug will be additional_information
. For the purposes of this example, let’s call your tabs “Additional Tab 1” and “Additional Tab 2.” Therefore the slugs we’re working with are additional_tab_1
and additional_tab_2
. If you need any help finding the slug of your tab (e.g. if it includes special characters), just send me a link to your product page and I will tell you the slug names.
The second thing we need to know is the role that you want to check against. For our purposes, we’ll use the administrator role.
The function should then look like this:
add_filter( 'yikes_woo_filter_all_product_tabs', 'yikes_woo_add_tab_permissions', 10, 2 );
function yikes_woo_add_tab_permissions( $tabs, $product ) {
if ( isset( $tabs['additional_tab_1'] ) && ! current_user_can( 'administrator' ) ) {
unset( $tabs['additional_tab_1'] );
}
if ( isset( $tabs['additional_tab_2'] ) && ! current_user_can( 'administrator' ) ) {
unset( $tabs['additional_tab_2'] );
}
return $tabs;
}
Make sure to replace your current function with the one above (rather than having both of them).
Let me know how that goes.
Cheers,
Kevin.