Custom order information

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #20107
    cubic
    Participant

      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 !

      #20112
      Olly
      Admin & Mod

        are 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/

        #20113
        cubic
        Participant

          Yes, 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.

          #20114
          cubic
          Participant
            This reply has been marked as private.
            #20115
            Olly
            Admin & Mod
              #20118
              cubic
              Participant

                Yes 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.

                #20134
                Olly
                Admin & Mod

                  there 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)

                  #20135
                  cubic
                  Participant

                    Ok thank you for your answer. I’ll do some tests.

                  Viewing 8 posts - 1 through 8 (of 8 total)
                  • The topic ‘Custom order information’ is closed to new replies.