Replies: 0
Hi everyone,
My woocommerce is attached to an ERP named Dolibarr and Splash Sync make the synchronization between them. I have the woocommerce bookings plugin, and my problem is here :
When I made a booking, Dolibarr retrieve correctly the data from the booking, except the date when the booking begin. I need that date of course but the only date I have is for the order creation.
So I tried to change this date and assign it the start date of the booking.
Example : We are in october, the 18th, if I make a booking for november the 1st, I want to have as order date november the 1st, and not october the 18th.
I tried this way :
add_action(‘woocommerce_checkout_create_order’, ‘before_checkout_create_order’, 20, 1);
function before_checkout_create_order($order) {
$order = wc_get_order($order);
$order->set_date_created(‘2018-10-20 00:00:00.000000’);
$order->set_date_paid(‘2018-10-20 00:00:00.000000’);
$order->set_date_modified(‘2018-10-20 00:00:00.000000’);
return $order;
}
But an “Internal server error” occured. Apparently the system doesn’t accept any date changement during checkout.
Here’s a few links I used to achieve this :
The hook ‘woocommerce_checkout_create_order’
Change order total during checkout
https://stackoverflow.com/questions/49036503/change-order-total-after-checkout-in-woocommerce
Change shipping address during checkout
https://wordpress.stackexchange.com/questions/273907/filter-hook-before-create-order-woocommerce
If anyone has an idea, it would be greatful, thank you 🙂
- This topic was modified 30 seconds ago by allandore.