I have two roles: ‘Subscribers’ and ‘Editors’.
I would like only to editors is applied the discount.
Something like: if (current_user_can (‘editor’)) { Volume Discount } else { No Volume Discount }
Is it possible? I tried but for some reason I can not get it to work.
Could you give me some advice?
How about if the user is not editor then stop volume discounts from working?
In the shopping_cart.php near the top.
//get the logged in user
$current_user = wp_get_current_user();
if ( !($current_user instanceof WP_User) )
return;
//get the users capabilities
$roles = $current_user->roles; //$roles is an array
//if the user cannot do something that only Editor and up can do then get rid of the javascript that controls volume discounts.
if (!current_user_can('upload_files')) {
//do stuff for administrator roles
wp_deregister_script( 'espresso_volume_discount' );
}
This reply was modified 11 years, 1 month ago by Dean. Reason: code messed up
The support post ‘Conditional use of Volume Discount’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.