Posted: August 25, 2021 at 1:06 pm
Hello! We have the promotions add-on installed and it has worked well for years. Suddenly, none of our promotion codes are being accepted. We get an error that says: We have checked the settings and made sure the codes are set to unlimited use for all events. Any suggestions for fixing this error? Thanks! |
|
Hi Emily, Can you post a screenshot of the settings for your promotion code, please? https://eventespresso.com/wiki/troubleshooting-checklist/#screenshots (Note you can set your post to be private if preferred) Or, if you prefer for me to look at it directly just send over temp login details using this form: |
|
This reply has been marked as private. | |
|
Hi Emily, I hope you are well. We received your login details. Thank you! Yes, it is working. We are working on it now. Thanks for your patience. |
|
Hi, I can see that you have a caching plugin installed, called WP Rocket. This could be causing issues because sometimes the registration pages get cached on the server. I can see that when I go to one of your events and found this in the right sidebar: https://www.screencast.com/t/7Lq4HEdZ Try clearing the cache and excluding the event pages from the cache. Please refer to the steps in the link below under “Setup no-cache/exclusion rules for WP Rocket” https://eventespresso.com/wiki/setup-nocache-exclusion-rules-event-espresso/ Then try testing the promo codes again. Did this help? |
This reply has been marked as private. | |
Hi Emily, My apologies for the delayed reply. I’ve just added a couple of test registrations to one of your events using the promotion code in your opening post, which worked as expected. Is there a specific event you are testing this on? |
|
Note I’ve left the registrations on your site simply so you can see they processed, if you’d like to remove those please feel free. If you prefer I remove them just let me know. |
|
This reply has been marked as private. | |
Hi Tony! I also wanted to add that I tried registering with FREEOERA and still got the error message. Emily |
|
|
Hi Emily, I am sorry to hear that you are still getting the promo code error. Sounds like you are having a caching issue still since Tony was able to apply the code without a problem. To test, you can try doing it in a device that you haven’t used to apply the promo code. Did this work? If yes, go back to the computer you got the error from and follow these steps: In Chrome Try the registration and apply the promo code. Does this help? Thanks! |
This reply has been marked as private. | |
This reply has been marked as private. | |
This reply has been marked as private. | |
Hi Emily, I’ll explain a little on how the promotions are applied so this makes more sense. When a promotion code is submitted, EE first pulls the promotion object itself based on the code supplied. What it does then works out if your cart has ‘items’ that are applicable to the current promotion it pulled from the above. It does this by first pulling all event objects in your current cart and saving them to an Then using the promotion object from above it pulls any objects (Events) that promotion applies to and saves those to a As it now has both of those it can compare the After that, it filters Now, the specific error you are getting when submitting the promotion codes in question means that When I mentioned disabling that custom plugin, I meant disable it for long enough for you to submit a promotion code that you know currently does not work and see if it works then. If you then re-enable the plugin and the same promotion code no longer works, there is an issue with what that custom plugin is doing which will need to be fixed. —-
I can’t answer that as I didn’t write that custom plugin, I can tell you that the custom code you have is basically pulling ALL promotions on the site, looping over them all to get the ID’s for each of them. Like so:
Then looping over ALL EE events and pulling available tickets to do the same, loop over them and pull their ID’s:
Then using array_fill_keys() to build and array of promotion ID’s that applies to every active ticket:
Then filtering There’s a lot going on in that function that can be narrowed so it only works on the current events/tickets/promotion code in the cart before it passes anything to the function I linked above in Ideally, you need a custom plugin that creates a ‘ticket’ scope for the promotions add-on as current it runs on everything.
As far as I can tell, nothing, which is why you need to test this without that custom plugin running to narrow down if the issue is with the promotion itself or the custom code (I suspect it’s the latter). |
|
This reply has been marked as private. | |
Looking at the working codes it looks like the promotions that are set to be global work but any set for individual events/groups of events don’t. The code needs to be debugged properly to know what each variable holds to know more.
As this isn’t an issue with Event Espresso itself we would recommend you contact the author of the plugin to troubleshoot their code and fix this. The snippet they are using from our repo was intended to allow promotions to apply to certain tickets which has then been put together by pulling in everything to pass to the function which basically then makes it more complicated than it needs to be. Just to clarify, you’re trying to get ALL promotions on your site to apply on a per ticket basis rather than per transaction? |
|
The support post ‘Promotion Codes Not Working’ 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.