Posted: October 9, 2019 at 8:17 am
|
I see this feature was discussed in 2015 and 2016. https://eventespresso.com/topic/discounts-by-ticket/ It seemed like over 80 of your users voted in favor of having discount codes being applied to certain ticket types. Any update on this feature? It is really something I need to continue my subscription. What would it cost to sponsor the development of this feature as Seth suggested? |
Hi, One update that did happen since then is the promotions add-on now includes hooks that allow for programmatically setting a specific ticket to allow a specific promotion. An example of how to use the hooks is hosted here: With the above, a PHP developer could build out a system of discounts per ticket to your specifications. If you’d prefer to look into sponsorship of a ticket per promotion user interface, to be included in an official update to the promotions add-on, you can reach out to Seth via this form: https://eventespresso.com/rich-features/sponsor-new-features/ |
|
|
I have tested out the code and it does indeed limit promo codes to specific tickets. However it ignores the use limit, which I still need The filter “FHEE__EED_Promotions__add_promotion_line_item__bypass_increment_promotion_scope_uses” appears to be responsible for bypassing the use limit. I’ve tried setting the return value to false as well as commenting out the entire add_filter() line in hopes of enforcing the use limit. No luck. Do you know if there’s a fix for this? |
The filter is supposed to bypass the use limit, because what’s happened is the event scope is no longer in effect. There isn’t a check for “ticket scope usage limit”. Usage limits are applied to and checked against for the event scope. What you could do in this case is add some additional logic and a loop at the very end of the main loop that gets the event ID from the tickets, then applies the usage for the promotions to the event scope. At that point it will work because the plugin still checks for the event scope’s usage limit. e.g. add the following just before the end of the main foreach loop
|
|
|
This is great. Only issue I found is that the use limit isn’t applied until after a transaction pushes the usage count to equal or greater than the use limit. For example, let’s say promo code XYZ has a use limit of 4. The newly added foreach loop will allow me to apply the code to 5 tickets. After I complete the transaction, the promo code is no longer valid and prompts as such. Is it possible to make the use limit apply for this use case? |
What’s actually allowing you to apply the code to 5 tickets is the change to the ticket scope from event scope (the first part of the custom code). The newly added foreach loop only adds to increment the count of promo code uses. You can add a conditional to the top of the innermost loop and that will prevent going over the limit:
Normally the above check isn’t needed because only one scope item would be applied regardless of the number of tickets. |
|
|
It still allows that extra ticket to work with the code. Did I place it in the correct loop?
|
|
Sorry, in the above code block I tried to bold the added code to emphasize its placement. “” and “” isn’t in my actual code. |
Can you explain what you mean by this? It may help to know the exact scenario you’re testing because I’m probably not testing the changes the same way you’re testing. If you can outline a list of testing steps we can examine further. |
|
|
Here is a link to the staging version of the Event Espresso integration – http://staging.microgridknowledge.com/microgrid-2020-conference/register/ The promo code AMERCOMP applies only to “Early Registration” and “Early Registration & Microgrid Tour”. It’s a dollar discount of $895 and it can only be used 4 times. With those settings, the expectation is that it should only apply to the first 4 tickets and any additional tickets are full price. However, in a single transaction I can checkout with 5 tickets and the discount will apply to all. |
Hi, I’m sorry for the delay. I did some refactoring on the parts that add usage monitoring which will avoid the above scenario. Here’s a gist that includes all the changes: https://gist.github.com/joshfeck/370b03db00befd7118fb32d959130a71 |
|
The support post ‘Discount by Tickets’ 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.