• Resolved allandore

    (@allandore)


    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’

    https://stackoverflow.com/questions/25626058/add-extra-meta-for-orders-in-woocommerce/48502896#48502896

    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 7 years, 7 months ago by allandore.
Viewing 1 replies (of 1 total)
  • Plugin Support mouli a11n

    (@mouli)

    Hi there,
    Can I suggest that you try syncing using the value of _booking_start which corresponds to the post_id of the booking in question in the wp-postmeta table.

    I’m not sure why you are trying to modify the post creation date when the start date of the booking itself might be accessible to your sync engine.

    As WooCommerce Bookings is a Premium plugin I’d also suggest that you log into your WooCommerce account and submit a Support Ticket so that you can get help from the whole team.

    Having said that if the problem is more to do with Splash Sync not pulling the right data, then you might benefit from seeking help from them.

    I hope that helps you to figure it out.

Viewing 1 replies (of 1 total)

The topic ‘Change created date during checkout’ is closed to new replies.