Posted: March 27, 2020 at 3:08 pm
We have to use price modifiers to represent the tax as EE does not allow for different tax amounts for different events (HST applies in some provinces but only GST in others). When applying promotion codes it applies a discount after the tax is calculated which leaves us with an incorrect tax amount on the invoices/receipts. |
|
This code snippet is one solution: https://gist.github.com/joshfeck/d4c013dd1b64807fee2e8d4c4d237456 This example code could be modified to work per event, but the way it works as-is involves adding a “Billing Address Province” question to the registration form. So if the registrant selects Alberta, it adds 5% at checkout. This solution might work for you because of instead of setting the tax rate on the event, the location of the attendee determines the tax rate. The end result works out like this: https://slack-files.com/T02SY781D-FUP143GET-176322084d The custom code snippet can be added to a functions plugin. |
|
We need the tax rate tied to the event location not the location of the attendee so I will have to modify it to make it work the way we need it. I will let you know if I need any assistance with the modifications. |
|
In that case, the logic in that first method wouldn’t be needed (since the logic is based on the answer of a reg. form question). In that last method, the EE_Checkout object is passed in. You can get the event via the EE_Checkout object and add in logic there. e.g.
|
|
Thanks, Josh, I have managed to turn this into a working plugin but I do have one quirk. As a workaround I have done this: I see plenty of examples using the first technique in the support forum but it hasn’t worked for me. |
|
You could do this to get the venue object from the event object:
|
|
Thanks! That works nicely and cleans up the code a bit. Not only does this fix the problem of promotion discounts not affecting the calculated tax but it also removed the need for applying Price Modifiers to every ticket type. Is it worth sharing the working code back to this thread? |
|
That’d be much appreciated. Since the forums don’t format code well, putting the code into a gist or pastebin is best. If that’s not too much trouble. Otherwise, you can wrap the code in code tags or backticks like |
|
I have added the code to Pastebin. This is the first time I’ve shared code this way and I hope that it works for everybody: |
|
The support post ‘Promotion Discount Not affecting Tax applied by a Price Modifier’ 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.