WPPizza – A Restaurant Plugin for WordPress › Support › General Support › Custom order information
- AuthorPosts
- 16 August, 2016 at 11:28 am #20107
Hi,
I added a drop-down list to enable customer to choose a day-time for delivery or pick-up on the Order page (different if he choose delivery or pick-up).
I used :
add_action( 'wppizza_order_form_after_totals', 'add_date_time', 10, 2 );
and some javascript.
It works, no problem.
Now I am looking how to save this information to add to the email and order history.
I think the best solution would be to add in order_details (or order_ini) in DB with a filter, but I don’t find it.
What do you think ? What is the best way to add this custom information in order ?
Thanks !16 August, 2016 at 2:17 pm #20112are you perhaps over complicating things ?
Have a look/read here (under ==Note==) and just replace the comma separated list of postcodes mentioned there with your date/time values
https://www.wp-pizza.com/downloads/wppizza-delivery-by-postcode/
16 August, 2016 at 3:11 pm #20113Yes, it is a simpler solution ! I tried to do it like this. But I need to put the time dynamically because it’s not the same time for each day and I need to show only the next time available.
For example, if it’s 13:00 and the available delivery time is between 11:00 and 15:00, it only displays 14:00 – 14:30 – 15:00. So I write my own function and it works fine. But now I have to add this information somewhere when the order is saved and display it in email and order history.
I tried an other solution :
– Create a custom field in order form setting (a simple text field)
– Hide this custom field on front with css
– Fill this custom field with javascript when the customer choose day and time in order page.
It works, but it’s not very clean.
I continue to look for a best solution.
Thanks.16 August, 2016 at 3:17 pm #20114This reply has been marked as private.16 August, 2016 at 3:18 pm #20115try using this filter instead
https://www.wp-pizza.com/topic/adding-customer-checkout-fields/16 August, 2016 at 3:24 pm #20118Yes I tried this solution with this filter. But when I add a custom field with this filter, I can see it in order page, but not in email and order history after saving the order.
16 August, 2016 at 11:31 pm #20134there are another bunch of filters you’d have to use to make it appear in emails etc etc
however, it strikes me as a simpler solution to use one of the already exiting custom order form fields (based on https://www.wp-pizza.com/downloads/wppizza-delivery-by-postcode/ i referred to above) and just dynamically replace the options with an ajax call which is probably a better idea anyway for your scenario as times might “time out” so to speak even when someone stays on the page for an hour….
(this will require some testing . I dont know of the top off my head, but there _might_ also be a check that options exists in wppizza-> form settings before you can actually dynamically change this via js, but maybe there isn’t , in which case the above should work just fine)
16 August, 2016 at 11:44 pm #20135Ok thank you for your answer. I’ll do some tests.
- AuthorPosts
- The topic ‘Custom order information’ is closed to new replies.