Our client was selling a service based on booking in advance. They were using Booked plugin by Boxy Studio for this feature. Unfortunately it was not working properly for them. The problem was that when someone books a full day, the previous day cannot be booked. The previous day appears as unbookable or “blocked”. It was a strange problem that got us worried what could be causing this. We took the job and started troubleshooting.
Our task mainly was to:
- Test to see if the problem really exists
- Check if it’s caused due to misconfiguration
- Isolate the problem and see if the problem persists
- Find the reference code for the feature and investigate
- Prepare a fix plugin without editing the core files (as much as possible)
- Implement to client’s situation and test
The problem was simple, but we had to dig in deep into the code to get the solution.
Here’s how we solved the problem:
Replication & Configuration
We applied the steps client pointed out and was able to replicate the issue. We tried in many ways a user can book the plugin and even tried some tricks with browser devtool, but it did not help. We looked into configuration to check if it is correct. We found no faults there.
We setup a separate installation with just the minimum plugins to mimic the setup. We configured it like our client site and ran similar tests. This is to see if some other plugin was causing the issue. The result was not so hopefull. We got the same result as our client site. We have fiddled with configuration but it got us nowhere.
Diving into Code
We started looking into the code. It is the first time the project has seen some lights. We found out there was a mistake in the plugin code when it sets the time for the full day booking. It books the full day event starting 1 minute early from the previous day. So the calendar thinks that the day is not bookable for a full day booking.
Prepare a Fix
We tried some manual editing on MySQL database directly and increased the start time by 1 minute. And our investigation turned out to be fruitful. With the result from our investigation we found out that a fix is not possible without editing the plugin files. We edited and added a hook and modified the time values with that hook from our fix plugin so that editing is minimal as possible.
We copied our client site, implemented our fix and tested. We tested with multiple scenarios as much as we could. At the end, our fix was successful. It solved the problem perfectly.
Are You Interested?
We can get you hooked to a similar project!
Some images might be subject to copyright. In case otherwise stated, the copyright belongs to the copyright holder.