Support

Home Forums Event Espresso Premium Conditional use of Volume Discount

Conditional use of Volume Discount

Posted: September 30, 2013 at 3:05 am

Viewing 2 reply threads


Marco Genovese

September 30, 2013 at 3:05 am

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?

Thanks in advance


Dean

September 30, 2013 at 6:00 am

Hi,

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


Marco Genovese

September 30, 2013 at 7:59 am

Wow! Also this is resolved
Thanks a lot!

Viewing 2 reply threads

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.

Event Espresso