exclude email adres from pdf invoice

[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

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer