[ad_1]
Hi @jordibrain,
Currently, we do not have an option in the plugin’s settings to disable the PDF invoices for certain user roles, but you can achieve it with a PHP code snippet, taking advantage of the wpo_wcpdf_document_is_allowed filter hook, like this:
/**
* PDF Invoices & Packing Slips for WooCommerce:
* Disable invoices for certain user role
*/
add_filter('wpo_wcpdf_document_is_allowed', function( $allowed, $document ) {
if ( !empty( $order = $document->order ) && $document->get_type() == 'invoice' ) {
$user = $order->get_user();
if ( in_array( 'administrator', (array) $user->roles ) ) { // replace with another role
$allowed = false;
}
}
return $allowed;
}, 10, 2 );If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters
