Articles in this section

Available Timeslots Logic with Delivery Partners

The suggested time slots for order availability do not behave the same way as expected when using a 3rd party delivery service. Because we reply on external driver availability, we need to communicate with the delivery service ahead of time to ensure we suggest times that drivers will be available. 

So roughly speaking, there are three steps to submitting orders to the delivery service:
  1. Get estimates to display available timeslots and ASAP time
  2. When a timeslot is selected, and then again at checkout, we validate the selected time (and create an order Quote)
  3. After payment and submitting order to POS, confirm the delivery for the quoted order
Time slot suggestion logic: 
  • We first calculate what is the earliest (ASAP) pickup time at the location based on the store's delivery settings (prep time, notice period)
  • We then submit an estimate request to the delivery service, where we submit the ASAP pickup time
  • The delivery service should reply with estimates for their pickup and dropoff times. If the pickup time does not match what we requested, we verify that the new pickup estimate is doable by the location (and if not, repeat this process until we find a matching pickup time that is off by no more than 10 minutes).
  • Once we find a matching estimate, we read the dropoff time returned by the provider, round it up to a multiple of 5 min, and label it as the earliest (ASAP) available time. This is the time that is used for the ASAP estimate shown to the user.
  • Once we have the ASAP estimate, we proceed to generate the timeslots that we show to the user. For today's date, we basically start at the ASAP time, and from there start adding timeslots every few minutes (based on the store timeslot interval), up until the store's closing time.
  • For future dates, we basically repeat the previous process by first checking what is the first available time for that day, and then generate the timeslots based on that time (we try to avoid additional calls to the delivery service when possible by "reusing" past results).
Was this article helpful?
0 out of 0 found this helpful