Available events

The following events are currently available in v5.0.2 and above. 

widget.loaded
selected_method
delivery.datepicker.rendered
delivery.datepicker.opened
delivery.timepicker.rendered
delivery.timepicker.opened
pickup.datepicker.rendered
pickup.datepicker.opened
pickup.timepicker.rendered
pickup.timepicker.opened
validation.order_notes
rates.checkout_update_request
rates.checkout_update_success
rates.checkout_update_error

Listening for events

You can listen to the events by using the following code

<script type="text/javascript">
$(document).ready(function() {
  window.ZapietEvent.listen('pickup.timepicker.opened', function() {    
    // Callback code
  });
});
</script>

Checkout method update example

<script type="text/javascript">
$(document).ready(function() {
  window.ZapietEvent.listen('selected_method', function(checkout_method) {    
    switch (checkout_method) {
      case "pickup":
        // Do something when pickup is selected
        break;
      case "delivery":
        // Do something when delivery is selected
        break;
      case "shipping":
        // Do something when shipping is selected
        break;
    }
  });
});
</script>

Hidden attributes

We add a number of hidden attributes to your orders. We have documented these below.

attributes.Checkout-Method (pickup, delivery or shipping) 
attributes.Pickup-Location-Id
attributes.Pickup-Location-Company
attributes.Pickup-Location-Address-Line-1
attributes.Pickup-Location-Address-Line-2
attributes.Pickup-Location-City
attributes.Pickup-Location-Region
attributes.Pickup-Location-Postal-Code
attributes.Pickup-Location-Country
attributes.Pickup-Date
attributes.Pickup-Time
attributes.Delivery-Location-Id
attributes.Delivery-Date
attributes.Delivery-Time
attributes.Delivery-Slot-Id (Internal use only)
attributes.Shipping-Date
Custom-Attribute-1
Custom-Attribute-2
Custom-Attribute-3
Did this answer your question?