Usually, you would not check the user role, but the user's capabilities via current_user_can, and use a plugin such as User Role Editor to add the custom capabilities to certain roles. This is much more flexible to use in the long term, see Roles and capabilities (for example, do you want your wordpress admin user to behave like this or not?). Normally a plugin would have checks like:
if (!current_user_can('my_plugin_cap')) {
wp_die('Not allowed');
}
Now in your case the challenge would probably be how to add this in a way where the plugin does not need to be modified. As the functionality the plugin is adding is often added via wordpress actions/filters (woocommerce works like this), you can remove it like this:
add_action('woocommerce_integrations', 'my_check_capability', 1); // Adding this before the plugin is called
function my_check_capability() {
if (!current_user_can('my_plugin_cap')) {
remove_action('woocommerce_integrations', 'make_cart_stock_reducer_go_now' ); // Disable the plugin, do as if the plugin didn't exist, if not enough capabilities
}
}
This code needs to be added in your theme's functions.php
or so.