WooCommerce Bookings customisation and speed enhancement
Budget: $30 – $250 AUD
We are running a WooCommerce site also use WooCommerce bookings.
We are an equipment hire business, that hires by the day (in most cases we give people three days hire for each booking).
Our calendar availability load time on each product page is painfully slow. We have found that we need to make changes to our class-wc-product-booking.php file, to have Woo call the availability in either hours or days, rather than the standard minutes. Minutes is causing a bottle neck (as per a post I've read).
Just need someone to make the necessary PHP changes, and while you are in there, our site needs to do a PHP update, we would like you to do this too.
Remember, the post below deals with accommodation where they need to check people in and out on the same day, we do not need this level of granular availability, as all our products are booked in 3 day blocks EXCEPT one - which we book by the day.
HERE IS A COPY OF THE POST ON WOOCOMMERCE
We ran the shop locally with webgrind to trace the stack and the bottle neck is ‘get_unavailable_mintues()’ in /includes/class-wc-product-booking.php If you look at that trace, you will see the array_push can be called, in some cases, millions of times. The code isn’t terribly clear but the hypothesis that its checking each minute for a booking definetely seems correct.
If you then look at class-wc-product-accommodation-booking.php and the return of get_duration_unit(), its ‘night’ This is passed back to class-wc-product-booking.php but the unit only has one use in the entire code, so I believe the system defaults back to ‘minute’ and runs accordingly.
Long story short, if you change the get_duration_unit() to ‘hour’, the system is about 60% faster. If you change it to ‘day’, the system is over 90% faster (But this is not usable in production systems as you loose the ability to checkin/out on the same day.
We left get_duration_unit() as ‘night’ and made some changes in the class-wc-product-booking.php to force the system to assume its working with ‘hour’ e.g. Check units are hours and advance all timescales by hours, not minutes. I don’t believe any performance can be gained here as you need the granularity of ‘hour’ but there may be some intelligent shortcuts that could be taken e.g. If the checkin / checkout days are known along with the times, you don’t need to check the whole day.
We are an equipment hire business, that hires by the day (in most cases we give people three days hire for each booking).
Our calendar availability load time on each product page is painfully slow. We have found that we need to make changes to our class-wc-product-booking.php file, to have Woo call the availability in either hours or days, rather than the standard minutes. Minutes is causing a bottle neck (as per a post I've read).
Just need someone to make the necessary PHP changes, and while you are in there, our site needs to do a PHP update, we would like you to do this too.
Remember, the post below deals with accommodation where they need to check people in and out on the same day, we do not need this level of granular availability, as all our products are booked in 3 day blocks EXCEPT one - which we book by the day.
HERE IS A COPY OF THE POST ON WOOCOMMERCE
We ran the shop locally with webgrind to trace the stack and the bottle neck is ‘get_unavailable_mintues()’ in /includes/class-wc-product-booking.php If you look at that trace, you will see the array_push can be called, in some cases, millions of times. The code isn’t terribly clear but the hypothesis that its checking each minute for a booking definetely seems correct.
If you then look at class-wc-product-accommodation-booking.php and the return of get_duration_unit(), its ‘night’ This is passed back to class-wc-product-booking.php but the unit only has one use in the entire code, so I believe the system defaults back to ‘minute’ and runs accordingly.
Long story short, if you change the get_duration_unit() to ‘hour’, the system is about 60% faster. If you change it to ‘day’, the system is over 90% faster (But this is not usable in production systems as you loose the ability to checkin/out on the same day.
We left get_duration_unit() as ‘night’ and made some changes in the class-wc-product-booking.php to force the system to assume its working with ‘hour’ e.g. Check units are hours and advance all timescales by hours, not minutes. I don’t believe any performance can be gained here as you need the granularity of ‘hour’ but there may be some intelligent shortcuts that could be taken e.g. If the checkin / checkout days are known along with the times, you don’t need to check the whole day.