I am trying to add an online only discount for all events. so all order through the website would receive a automatic discount but all orders through the admin panel (ie. phone order done my staff) no discount is applied. to promo users to use the website and not call us.
I see codeless promotion will automatically apply a discount which is great but this is also applied when making a booking through the admin panel.
So from want i can see i have 2 options either:
1. writing a function to remove promotions from being applied when booked through the admin
2. writing a function to automatically apply a coded promotion when booking through the frontend.
Do you have any thoughts on how i should approach this problem, or a non custom function way to do this?
The approach I would take is #1, its easier to remove a function than it is to add your own…. which would be doing the same thing as the promotions add-on anyway.
Luckily, this is actually fairly simple to do.
So if your in the admin you don’t want promotions to apply to the cart meaning an is_admin() check is needed, however, all WP ajax requests return true for is_admin() meaning we need to check explicity for ajax requests (the front end uses ajax to apply the promotions) so we also need ! (defined('DOING_AJAX') && DOING_AJAX).
Then if those conditions are true, remove the action the Promotions add-on sets to automatically process promotions on in the cart:
Add that function to a Custom Functions Plugin on your site and test both a front end registration and one add via the admin.
Viewing 1 reply thread
The support post ‘Online only 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.