Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-sales domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the better-click-to-tweet domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-amazon domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-stats domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
Conditional use of Volume Discount | Event Espresso - Staging Server

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

  • Support Staff

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, 3 months 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 - Staging Server