I would like to add a bookable product to the cart programatically, with a date set so the slot is reserved — just as if the user used the booking calendar on the single product page.
I have been able to achieve the functionality with the solution proposed here [https://stackoverflow.com/questions/47741066/how-to-add-a-bookable-product-to-woocommerce-cart-programmatically] with having a form that submits to the same page but this is not an ideal solution.
I have searched through the plugin files to find out how the booking calendar adds the cart item but cannot work out how.
It does not work by doing WC()->cart->add_to_cart($id)
sadly.
This is using WooCommerce with the WooCommerce Bookings plugin.