Posted: November 1, 2019 at 6:14 am
|
I have an event with three ticket types. I want to create a promotion code that applies to two of the three ticket types. Early Bird -> Promo code applies How may I do this? I do have a custom site plugin for other EE display tweaks. Version 4.10.1.p |
Hi there, Officially, you can’t with the current version. The promotions add-on applies promotions to events rather than tickets within events. However, we do have a snippet that can work for some use cases here: You set up the So lets say you promotion ID is 10 and the ID of the 2 tickets you want it to be available on is 22 and 26, your array would look like this:
That promotion will then only apply to those tickets. Is that what you are looking for? |
|
|
I worried when I looked at the code in github, until I found I only needed to change one line, and the snippet was very specific about not changing any other code. Nicely done. The solution works as described. When I tested a generic “declined” message was displayed, not the declined message in the Promotion. I didn’t find an obvious setting in General Settings or an event message to change. What am I missing? As I added the code to my site plugin, I noticed the snippet completely disables the Promotion field when I set a custom field to a specific value. This would actually be preferable. When the ticketid == 25, do not show the Promotion code box. Can this be done? |
Hmm, strange. Which type of decline are you testing here? No more uses? If you can add some details of what you have set up I’ll see if I recreate locally and see what is happening.
It does? Can you add some more details on what you are doing here? |
|
|
I modified the github code mentioned Nov 1 with this line for event 13, ticket types 23 & 24 which are to be included in the promotion code. $applicable_promotion_tickets = array( 13 => array(23,24)); ticket type 25 is for a group rate (2 to 4 participants) and should not be included in the promotion. the promotion code is for $ 100 off. The decline message in the promotion configuration is “Declined When I test the group registration, the promotion field shows. When I type in the promotion code, I get the following pop-up. This indicates the reason may be a typing error, not a “You can’t have the discount error”.
I run another event for which promotion codes do not apply. For those events, I create a custom field “coupon”, with the value “no”. I believe this code came out of github. // don’t display promo code input for specific events by setting Custom field to coupon == no Thinking about the dynamics, I’d really like to not display the promotion field for group registrations (ticket 25) rather than display a Decline message. I’m not sure this can be done, but thought I’d ask. |
Ok, so the message you posted is the ‘no applicable items notice’, because the promotion used can’t be applied to the event and no others can apply to the cart it shows the above. That message can be changed, but not to include the specific promotion code declined message as it doesn’t have access to it currently. It would also change it for all instances of the ‘no applicable items’ notice.
My apologies, I misunderstood this and thought you were referring to the original snippet for applying promotions to specific tickets. That snippet works on a custom field set on the events but it is possible to do something similar using ticket ID’s, to do that you would do something like this: https://gist.github.com/Pebblo/c09ff7a1ee5ac618a41771a901661814 Set the Ticket ID’s in the array on line 24: If any of the ID’s set there match the ID’s of any of the tickets that are in the cart, the promotion input field will be removed. |
|
|
My original expression of what I am doing was muddled. I realized it after I reread my text.
How interesting. Line 24 in the routine is exactly what I need! First level testing reveals that: 1. For group tickets (25), the promo code field does not show. I appreciate your help improving the registration experience for the workshop! |
You’re most welcome, I’m glad that worked for you. |
|
The support post ‘Limit promotion code to specific ticket class/type’ 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.