Home › Forums › Front-end Issues › delivery date to checkout page + order + emails
Hello,
can someone help me to add custom fields (delivery date + time) to an order ?
I would like that the customer select the delivery date + delivery time on the checkout page.
Then these data are saved to the customer order, can be display on the backend and email sent.
I’ve tried the following for a start but nothing is displayed :
add_action( 'woocommerce_after_order_notes', 'my_custom_checkout_field' );
function my_custom_checkout_field(){
the_field('deliverydate',WC()->order->id);
echo ' MY TEST FUNCTION
';
}
who can help me please ?
Cheers,
Kindly check this page to learn how to customize the checkout page: https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/.
Because this is not related to ACF, kindly get in touch with WooCommerce support for further support.
I hope this makes sense 🙂
Hi James,
any tip is always welcome thank you.
I’ve found this ressources as well, but I thaught I could use ACF to display my fields and store the correct values.
Cheers,
marc
Because WooCommerce is the one that handles the checkout page, ACF won’t be able to do anything on that page.
To add ACF input fields, you can use the acf_form() with ‘form’ option set to false
. That way it will be integrated to the checkout form. But you need process this form manually.
On the link I gave you before, it uses woocommerce_checkout_update_order_meta
hook to process the form, so you need to do it here too. Using this hook, you can use the update_field() function to update the field for the order.
I hope this makes sense 🙂
Hi James,
Thank you very much, I understand better now. I’m a newbie with ACF.
In ACF backend, my fields groupe (delivery date + delivery time) have the post id 730.
works fine with
acf_form(array('form' => false,'fields_group' => 730));
This first step jumps me to another question :
how can I configure the date picker ?
For example :
– past dates are not allowed
– max 10 days ahead
– some days are not choosable (because shop is closed).
…
Thank you for helping,
Cheers,
Marc
Regards,
ACF uses jQuery Datetimepicker to add the input fields. To modify it, you need to modify the arguments. This page should give you more idea about it: https://www.advancedcustomfields.com/resources/adding-custom-javascript-fields/.
Hope this helps 🙂
The topic ‘delivery date to checkout page + order + emails’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.