Debugging Woocommerce Bookings and Orders

Job ID: 38565623

Budget: $30 – $250 USD

We have a site based on Wordpress and Woocommerce, with Woocommerce Bookings as an addon. We have a problem with double (and sometimes triple or more) bookings on the same order, although the customer only booked one. The problems occur occasionally. Most of the orders and bookings are OK, but 5-10% of them have this issue. One booking is "correct" and the other one has errors. The one with errors is not visible on the order. It's only listed under bookings. If I try to open the booking I get a mail from the site about a technical problem. We used WP Fastest Cache before and I was thinking that that could be the reason for the problem so I turned it off about 2 weeks ago. I also increased the WP Memory limit. But the problem is still there, although I think it was worse before I turned off the cache. I checked the Site Health and found a recommendation there: "The scheduled event, action_scheduler_run_queue, is late to run. Your site still works, but this may indicate that scheduling posts or automated updates may not work as intended". I have had the debug log active for a couple of weeks as well. A very common message in the log looks like this: "WordPress database error Commands out of sync; you can't run this command now for query SELECT a.action_id FROM wp_actionscheduler_actions a WHERE 1=1 AND a.hook='wc_schedule_pending_batch_processes' AND a.status IN ('in-progress', 'pending') LIMIT 0, 1 made by shutdown_action_hook, do_action('shutdown'), WP_Hook->do_action, WP_Hook->apply_filters, Automattic\WooCommerce\Internal\BatchProcessing\BatchProcessingController->Automattic\WooCommerce\Internal\BatchProcessing\{closure}, Automattic\WooCommerce\Internal\BatchProcessing\BatchProcessingController->remove_or_retry_failed_processors, call_user_func, as_has_scheduled_action, ActionScheduler_Store->query_action, ActionScheduler_DBStore->query_actions". This message is followed by a few more, similar messages. These messages appear a few times every day. Today I optimized the database using ManageWP's tool for it. Don't know if that will help, but the back-end is a little bit faster now I think. I need help with debugging this problem from someone who is a Woocommerce expert.
Related categories: PHP JavaScript WordPress HTML WooCommerce