Support

Home Forums Event Espresso Premium Displaying volume discounts if a promotional code is used

Displaying volume discounts if a promotional code is used

Posted: September 28, 2013 at 8:14 am


Nick Putman

September 28, 2013 at 8:14 am

Hi,

I am using the Volume Discounts add on, which is applied if a user adds 5 bookings or more. I am also using a promotional code for an event, and I don’t want people to be able to use both at the same time. So, I am wondering if there is a way of disabling the volume discount if a promotional code is used. I don’t mind tampering with a bit of PHP if this is necessary!

Thanks,

Nick


Dean

September 30, 2013 at 2:43 am

Hey,

I don’t think PHP is a good option here as it’s server side code, but jQuery would be.

I would do something like this, but please note this is just a very quick example to get you started, it doesn’t calculate if you have more than one event/ticket type, if you need further coding assistance I would recommend contacting a developer

var count = ''; 
jQuery('.price_id').change(function() { 
   var count = jQuery(this).val(); 
   //console.log(count); 
   //if(count >= 5) { 
      jQuery('#event_espresso_coupon_wrapper').hide(); 
   } 
});

It wont, and Im honestly not sure how you would go about it, stop people from adding in a discount code and then selecting the number of tickets.


Nick Putman

September 30, 2013 at 2:54 am

Thanks Dean. I am a little confused by your message. It looks like you are saying that the simplest method is to hide the coupon div if more than 5 bookings are added to the cart, as per your script (thanks for that!), as opposed to disabling the volume discount if a promotional code is used. If so, I am not sure what you then mean by:

It wont, and Im honestly not sure how you would go about it, stop people from adding in a discount code and then selecting the number of tickets.

Also, am I right in thinking that if someone was to add a promotional code before they added the number of bookings, and then added 5 bookings or more, the promotional code would still be applied, even though the coupon div would now be hidden (due to your script)?

Nick


Dean

September 30, 2013 at 4:46 am

Hi Nick,

Sorry if my wording was bad, but yes thats correct. The script will simply hide the box, but if they apply the discount first and then choose the number of tickets then both discounts will apply.

One way would be to perhaps remove the class associated with the ticket dropdowns (which activate the volume discount) if the promo code has something in it.

This is something (its not very good…) that may get you started. One thing it doesnt do is add the class back if they change their mind and remove the code. Something like this, in conjunction with the code I listed earlier might well work. It does need to be tidied and improved on though.

jQuery("#event_espresso_coupon_code").blur(function() {var promo = jQuery("#event_espresso_coupon_code").val().length; if (promo > 0) { jQuery('#price_id-27').removeClass("price_id"); } });

If you’re not sure what to do with all of this, I would strongly advise getting a developer to look at it, some one with jquery experience can probably resolve this quite quickly.

The support post ‘Displaying volume discounts if a promotional code is used’ 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