How do I allow a specific role to download invoices?

In order to allow a specific role to download invoices, simply add the following action to your themes  functions.php

function bewpi_allowed_roles_to_download_invoice($allowed_roles) {
    // available roles: shop_manager, customer, contributor, author, editor, administrator
    $allowed_roles[] = "editor";
    // end so on..
    return $allowed_roles;
}
add_filter( 'bewpi_allowed_roles_to_download_invoice', 'bewpi_allowed_roles_to_download_invoice', 10, 2 );

By default the roles of shop manager and administrators are allowed to download invoices.


Please test the functionality on a development environment of your website. If it ceases to work, please revert back to the original state of your website and follow the tutorial again.