Important Booking Pricing Improvements
Posted on May 3, 2013
We’ve just released some development versions – 18.104.22.168 & Pro 22.214.171.124 – which makes a big change to how booking prices are calculated, specifically with regards to tax calculations. This has taken up a lot of our time recently due to the amount of testing required, given all the possible combinations of settings offered by Events Manager, each producing different expected results.
We will be releasing version 5.4 which will include these new changes on Monday, along with some other improvements specifically to the new Multiple Bookings feature in our Pro add-on.
This feature will probably (and should!) go unnoticed by the majority of users, but due to the importance of this specific aspect of the plugin, and certain changes to our code, we felt it was important to explain the changes and implications in detail.
Warning – This will be a long, and somewhat geeky read…. sorry!
Whilst working on various aspects of the plugin, we’ve noticed that the way booking price totals are handled needed a serious revamp. We’ll explain the specifics of what and why these changes are happening, but first we’ll start with the good stuff, which puts it all into perspective…. the benefits of this change.
Improvements and benefits
Overall, these changes make the way pricing is calculated more ‘sensible’, robust and simple for developers to use when extending Events Manager in whichever way they need.
Fixed tax rates per booking – Regardless of whether you change the tax rate on your site, or eventually within an event, that booking will remember the tax rate paid at the time.
Modify tax rates per booking – When editing a booking, along with being able to edit ticket spaces, custom fields, status and other details you can now also change the tax rate of any specific booking, irrespective of the global tax rate on your site.
Opens door to future per-event tax rates – With this new approach, we can eventually look at allowing per-event tax rates with minor modifications to the booking code. Future-proof!
Standard price discounts methodology – We now have a standardized way of applying a discounts on per-booking basis, which can be added before or after tax, and is what our own Pro coupons feature now hooks into as well. Developers can now easily hook in and add their own discounts to bookings without creating elaborate hooks into how prices get calculated.
Opens door to standard extra-charges – Much in the same way we’ve standardized discounting, we’ll be taking a very similar approach to adding extra charges to bookings, and this too will be made available to the free portion of the plugin.
Now that we’ve described the goal of these changes, let’s explain the underlying problem.
The underlying problem
Currently, bookings are saved without any information regarding the tax rate that was applied to the booking at the time of booking. When previous bookings are viewed taxes, and therefore the final price, are calculated on the fly by using the tax rate in your settings page (see screenshot below).
Whilst most users will usually never change the tax rate, the fact that you can makes it potentially confusing for previous bookings. Given the current economic climate (especially in Europe!), tax rates do change, and this makes this problem more obvious.
The second problem which is also related to the above, is how booked (not actual) ticket prices are stored within a booking. If you have chosen to add taxes to your ticket prices, you will see all ticket prices with the tax mark-up on the booking forms, and these will also consequently be stored in your bookings tables with taxes added. If you have chosen not to, ticket prices do not include taxes, and they are added on afterwards to the booking totals. Again, not a big deal if you never change the above, but if you do it will throw off price calculations.
What has changed
As mentioned in the benefits of this new update, tax rates are now saved along with the booking, so regardless of what you set or change in the settings, the tax applied to the booking will be the tax rate at the time of booking. You still have the option of changing this rate within each booking.
The tax rate for each booking will be saved in a new field called booking_tax_rate in your wp_em_bookings database table.
Additionally, ALL prices for tickets/spaces booked are saved WITHOUT tax, regardless of whether ticket prices display tax rates, and admins will see breakdowns of ticket prices plus tax added. This option to include tax in ticket prices will only be for display purposes.
How it affects previous bookings
When you upgrade to 5.4 (or the dev version), the current tax rate in your settings page will be saved along with the option whether to add taxes to ticket prices. These values will be stored as dbem_legacy_bookings_tax and dbem_legacy_bookings_tax_auto_add in your wp_options database table.
Modifications to tax settings on your settings page will now only apply to new bookings you make after making the change.
Previous Tax Rates
Any booking made before this upgrade will reference these archived tax settings, which will not change even if you update these values your settings page. Essentially, because the booking was not saved with a tax rate (if you look at the database, booking_tax_rate will be NULL), it will be assumed as an ‘old’ booking and reference this old tax rate.
Adding tax to ticket prices
If you never chose to add tax to ticket prices, this really won’t make any difference to you, skip this.
If you did, when retrieving older booking prices, Events Manager will assume that any older bookings without an specifically applied tax rate stored ticket prices with tax included, and so will deduct taxes from ticket prices when providing you with information about the booking, and re-add the tax during price breakdowns. Booking price totals shouldn’t be affected, this is just the way price breakdowns are displayed/calculated.
If you individually modify/resave a booking, the new way of saving booking info will be used, and a fixed tax rate would be applied to that booking, taking it out of ‘legacy’ mode.
Now that we’re done with this lengthy modification and improvement, it’s time to move forward!
We hope for those that wanted to know more, this was enlightening. We’re excited about getting this update out to you and even more about shifting our efforts to adding new features to Events Manager!