1. Home
  2. Order Delivery Date Pro for WooCommerce
  3. REST API

REST API

In the upcoming version 9.27.0 of Order Delivery Date Pro for WooCommerce plugin, we have added new REST API endpoints. We have used REST API in place of ajax calls in the plugin.

These endpoints can also be used for custom changes in the plugin or for use in external apps. The endpoints created are used to access some data from the plugin. These endpoints can be used to fetch the settings, available time slots and number of dates.

API Endpoints:

1. List all the delivery schedules ( default & custom ):

With this endpoint, all the delivery schedules are returned.

Request

GET/wp-json/orddd/v1/delivery_schedule
Response
{
      0: {
          delivery_schedule_id: 0,
          orddd_enable_delivery_date: ‘on’,
          orddd_delivery_checkout_options: ‘delivery_calendar’,
          number_of_dates: ’10’,
         weekdays: {},
         time_slots: {},
         holidays: {}
      },
      1: {
           delivery_schedule_id: 2,
           enable_shipping_based_delivery: ‘on’,
           delivery_settings_based_on: [],
           orddd_delivery_checkout_options: ‘delivery_calendar’,
           number_of_dates: ’10’,
           weekdays: {},
           time_slots: {},
           holidays: {}
      },
}

2. List Delivery Schedules by Setting ID:

This endpoint is used to fetch the general or custom settings. The setting id is the custom settings id and 0 for general settings.  It will return all the settings related to that setting id.

Request

GET/wp-json/orddd/v1/delivery_schedule/<setting_id>
Response
{
  "delivery_schedule_id": "5",
  "enable_shipping_based_delivery": "on",
  "orddd_delivery_checkout_options": "delivery_calendar",
  "delivery_type": {
    "weekdays": "",
    "specific_dates": ""
  },
  "minimum_delivery_time": "",
  "number_of_dates": "30",
  "date_mandatory_field": "",
  "date_lockout": "",
  "max_order_total": "",
  "enable_global_holidays": "",
  "enable_time_slot": "",
  "timeslot_mandatory_field": "",
  "time_slots": "",
  "timeslot_asap_option": "",
  "time_settings": {
    "enable": "",
    "from_hours": "",
    "from_mins": "",
    "to_hours": "",
    "to_mins": ""
  },
  "same_day": {
    "after_hours": "",
    "after_minutes": "",
    "additional_charges": ""
  },
  "same_day_charges": "",
  "next_day": {
    "after_hours": "",
    "after_minutes": "",
    "additional_charges": ""
  },
  "next_day_charges": "",
  "orddd_min_between_days": "",
  "orddd_max_between_days": "",
  "orddd_shipping_based_delivery_date_field_label": "",
  "orddd_shipping_based_delivery_timeslot_field_label": "",
  "orddd_delivery_charges_based_on_days_enable": "",
  "weekday_based_schedule_enable": "",
  "weekday_based_schedule": [],
  "orddd_additional_settings_based_on_days": {
    "number": [
      ""
    ],
    "label": [
      ""
    ],
    "charge": [
      ""
    ]
  },
  "delivery_settings_based_on": [
    "shipping_methods"
  ],
  "shipping_methods": [
    "free_shipping:30"
  ],
  "product_categories": [],
  "shipping_methods_for_categories": [],
  "orddd_locations": [],
  "orddd_pickup_locations": [],
  "categories_for_pickup_locations": [],
  "weekdays": {
    "orddd_weekday_0": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_1": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_2": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_3": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_4": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_5": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_6": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    }
  },
  "holidays": [],
  "specific_dates": []
}

For example – to fetch the custom settings with id 33 we would use – http://tychesoftwares.local/wp-json/orddd/v1/delivery_schedule/33

 

3. List all delivery schedules based on shipping method ID:

This endpoint will return all the custom settings for the given shipping method. The method id will be the name of shipping method and instance id from the shipping zone. If the method id is not mentioned then all the settings related to shipping methods will be returned. For example – if the custom settings is created for Free shipping, then we will use –

/wp-json/orddd/v1/delivery_schedule/?mode=shipping_method&shipping_method=free_shipping:21

Request

GET/wp-json/orddd/v1/delivery_schedule/?mode=shipping_method&shipping_method=<method_id>
Response
{
  "delivery_schedule_id": "5",
  "enable_shipping_based_delivery": "on",
  "orddd_delivery_checkout_options": "delivery_calendar",
  "delivery_type": {
    "weekdays": "",
    "specific_dates": ""
  },
  "minimum_delivery_time": "",
  "number_of_dates": "30",
  "date_mandatory_field": "",
  "date_lockout": "",
  "max_order_total": "",
  "enable_global_holidays": "",
  "enable_time_slot": "",
  "timeslot_mandatory_field": "",
  "time_slots": "",
  "timeslot_asap_option": "",
  "time_settings": {
    "enable": "",
    "from_hours": "",
    "from_mins": "",
    "to_hours": "",
    "to_mins": ""
  },
  "same_day": {
    "after_hours": "",
    "after_minutes": "",
    "additional_charges": ""
  },
  "same_day_charges": "",
  "next_day": {
    "after_hours": "",
    "after_minutes": "",
    "additional_charges": ""
  },
  "next_day_charges": "",
  "orddd_min_between_days": "",
  "orddd_max_between_days": "",
  "orddd_shipping_based_delivery_date_field_label": "",
  "orddd_shipping_based_delivery_timeslot_field_label": "",
  "orddd_delivery_charges_based_on_days_enable": "",
  "weekday_based_schedule_enable": "",
  "weekday_based_schedule": [],
  "orddd_additional_settings_based_on_days": {
    "number": [
      ""
    ],
    "label": [
      ""
    ],
    "charge": [
      ""
    ]
  },
  "delivery_settings_based_on": [
    "shipping_methods"
  ],
  "shipping_methods": [
    "free_shipping:30"
  ],
  "product_categories": [],
  "shipping_methods_for_categories": [],
  "orddd_locations": [],
  "orddd_pickup_locations": [],
  "categories_for_pickup_locations": [],
  "weekdays": {
    "orddd_weekday_0": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_1": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_2": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_3": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_4": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_5": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_6": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    }
  },
  "holidays": [],
  "specific_dates": []
}

 

3. List all delivery schedules based on categories:

This endpoint will return all the custom settings for the given product category with the given category slug. If there are multiple settings for a category then all of them will be returned.

For example: To get the custom settings for category Accessories, we will use /wp-json/orddd/v1/delivery_schedule/?mode=category&category=accessories

where ‘accessories’ is the category slug.

Request

GET/wp-json/orddd/v1/delivery_schedule/?mode=category&category=<category_slug>
Response
{
  "delivery_schedule_id": "1",
  "enable_shipping_based_delivery": "on",
  "orddd_delivery_checkout_options": "delivery_calendar",
  "delivery_type": {
    "weekdays": "",
    "specific_dates": ""
  },
  "minimum_delivery_time": "",
  "number_of_dates": "30",
  "date_mandatory_field": "",
  "date_lockout": "",
  "max_order_total": "",
  "enable_global_holidays": "",
  "enable_time_slot": "",
  "timeslot_mandatory_field": "",
  "time_slots": "",
  "timeslot_asap_option": "",
  "time_settings": {
    "enable": "",
    "from_hours": "",
    "from_mins": "",
    "to_hours": "",
    "to_mins": ""
  },
  "same_day": {
    "after_hours": "20",
    "after_minutes": "00",
    "additional_charges": ""
  },
  "same_day_charges": "",
  "next_day": {
    "after_hours": "",
    "after_minutes": "",
    "additional_charges": ""
  },
  "next_day_charges": "",
  "orddd_min_between_days": "",
  "orddd_max_between_days": "",
  "orddd_shipping_based_delivery_date_field_label": "",
  "orddd_shipping_based_delivery_timeslot_field_label": "",
  "orddd_delivery_charges_based_on_days_enable": "",
  "weekday_based_schedule_enable": "",
  "weekday_based_schedule": [],
  "orddd_additional_settings_based_on_days": {
    "number": [
      ""
    ],
    "label": [
      ""
    ],
    "charge": [
      ""
    ]
  },
  "delivery_settings_based_on": [
    "product_categories"
  ],
  "product_categories": [
    "accessories"
  ],
  "shipping_methods_for_categories": [],
  "orddd_locations": [],
  "orddd_pickup_locations": [],
  "categories_for_pickup_locations": [],
  "weekdays": {
    "orddd_weekday_0": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_1": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_2": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_3": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_4": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_5": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_6": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    }
  },
  "holidays": [],
  "specific_dates": []
}

 

4. List all delivery schedules based on Product Categories & shipping methods:

This endpoint will return all the custom settings related to a category & shipping method. Fox example, to get the settings for the Accessories category & Free shipping method, we will use /wp-json/orddd/v1/delivery_schedule/?mode=category&category=accessories&shipping_method=<method id>

Request

GET/wp-json/orddd/v1/delivery_schedule/?mode=category&category=<slug>&shipping_method=<method id>
Response
{
  "delivery_schedule_id": "1",
  "enable_shipping_based_delivery": "on",
  "orddd_delivery_checkout_options": "delivery_calendar",
  "delivery_type": {
    "weekdays": "",
    "specific_dates": ""
  },
  "minimum_delivery_time": "",
  "number_of_dates": "30",
  "date_mandatory_field": "",
  "date_lockout": "",
  "max_order_total": "",
  "enable_global_holidays": "",
  "enable_time_slot": "",
  "timeslot_mandatory_field": "",
  "time_slots": "",
  "timeslot_asap_option": "",
  "time_settings": {
    "enable": "",
    "from_hours": "",
    "from_mins": "",
    "to_hours": "",
    "to_mins": ""
  },
  "same_day": {
    "after_hours": "20",
    "after_minutes": "00",
    "additional_charges": ""
  },
  "same_day_charges": "",
  "next_day": {
    "after_hours": "",
    "after_minutes": "",
    "additional_charges": ""
  },
  "next_day_charges": "",
  "orddd_min_between_days": "",
  "orddd_max_between_days": "",
  "orddd_shipping_based_delivery_date_field_label": "",
  "orddd_shipping_based_delivery_timeslot_field_label": "",
  "orddd_delivery_charges_based_on_days_enable": "",
  "weekday_based_schedule_enable": "",
  "weekday_based_schedule": [],
  "orddd_additional_settings_based_on_days": {
    "number": [
      ""
    ],
    "label": [
      ""
    ],
    "charge": [
      ""
    ]
  },
  "delivery_settings_based_on": [
    "product_categories"
  ],
  "product_categories": [
    "accessories"
  ],
  "shipping_methods_for_categories": [
     "free_shipping:30"
  ],
  "orddd_locations": [],
  "orddd_pickup_locations": [],
  "categories_for_pickup_locations": [],
  "weekdays": {
    "orddd_weekday_0": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_1": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_2": {
      "enable": "",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_3": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_4": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_5": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_6": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    }
  },
  "weekday_based_schedule": [],
  "holidays": [],
  "specific_dates": []
}

 

5. List all delivery schedules based on Pickup Locations:

This endpoint will return all the custom settings related to a pickup location with the given Pickup Location ID. If the location id is not mentioned, then all the settings related to the pickup locations will be returned.

Request

GET/wp-json/orddd/v1/delivery_schedule/?mode=pickup_location&pickup_location=<location_id>
Response
{
  "delivery_schedule_id": "1",
  "enable_shipping_based_delivery": "on",
  "orddd_delivery_checkout_options": "delivery_calendar",
  "delivery_type": {
    "weekdays": "",
    "specific_dates": ""
  },
  "minimum_delivery_time": "",
  "number_of_dates": "30",
  "date_mandatory_field": "",
  "date_lockout": "",
  "max_order_total": "",
  "enable_global_holidays": "",
  "enable_time_slot": "",
  "timeslot_mandatory_field": "",
  "time_slots": "",
  "timeslot_asap_option": "",
  "time_settings": {
    "enable": "",
    "from_hours": "",
    "from_mins": "",
    "to_hours": "",
    "to_mins": ""
  },
  "same_day": {
    "after_hours": "20",
    "after_minutes": "00",
    "additional_charges": ""
  },
  "same_day_charges": "",
  "next_day": {
    "after_hours": "",
    "after_minutes": "",
    "additional_charges": ""
  },
  "next_day_charges": "",
  "orddd_min_between_days": "",
  "orddd_max_between_days": "",
  "orddd_shipping_based_delivery_date_field_label": "",
  "orddd_shipping_based_delivery_timeslot_field_label": "",
  "orddd_delivery_charges_based_on_days_enable": "",
  "weekday_based_schedule_enable": "",
  "weekday_based_schedule": [],
  "orddd_additional_settings_based_on_days": {
    "number": [
      ""
    ],
    "label": [
      ""
    ],
    "charge": [
      ""
    ]
  },
  "delivery_settings_based_on": [
    "orddd_locations"
  ],
  "product_categories": [],
  "shipping_methods_for_categories": [],
  "orddd_locations": [
     "orddd_locations_1"
  ],
  "orddd_pickup_locations": [],
  "categories_for_pickup_locations": [],
  "weekdays": {
    "orddd_weekday_0": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_1": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_2": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_3": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_4": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_5": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_6": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    }
  },
  "holidays": [],
  "specific_dates": []
}

 

6. /wp-json/orddd/v1/delivery_schedule/?mode=pickup_location&pickup_location=<location id>&category=<category slug>:

This endpoint will return all the custom settings related to a pickup location with the given Pickup Location ID and the category.

Request

GET/wp-json/orddd/v1/delivery_schedule/?mode=pickup_location&pickup_location=<location_id>&category=<slug>
Response
{
  "delivery_schedule_id": "1",
  "enable_shipping_based_delivery": "on",
  "orddd_delivery_checkout_options": "delivery_calendar",
  "delivery_type": {
    "weekdays": "",
    "specific_dates": ""
  },
  "minimum_delivery_time": "",
  "number_of_dates": "30",
  "date_mandatory_field": "",
  "date_lockout": "",
  "max_order_total": "",
  "enable_global_holidays": "",
  "enable_time_slot": "",
  "timeslot_mandatory_field": "",
  "time_slots": "",
  "timeslot_asap_option": "",
  "time_settings": {
    "enable": "",
    "from_hours": "",
    "from_mins": "",
    "to_hours": "",
    "to_mins": ""
  },
  "same_day": {
    "after_hours": "20",
    "after_minutes": "00",
    "additional_charges": ""
  },
  "same_day_charges": "",
  "next_day": {
    "after_hours": "",
    "after_minutes": "",
    "additional_charges": ""
  },
  "next_day_charges": "",
  "orddd_min_between_days": "",
  "orddd_max_between_days": "",
  "orddd_shipping_based_delivery_date_field_label": "",
  "orddd_shipping_based_delivery_timeslot_field_label": "",
  "orddd_delivery_charges_based_on_days_enable": "",
  "weekday_based_schedule_enable": "",
  "weekday_based_schedule": [],
  "orddd_additional_settings_based_on_days": {
    "number": [
      ""
    ],
    "label": [
      ""
    ],
    "charge": [
      ""
    ]
  },
  "delivery_settings_based_on": [
    "orddd_locations"
  ],
  "product_categories": [],
  "shipping_methods_for_categories": [],
  "orddd_locations": [
    "orddd_locations_1"
  ],
  "orddd_pickup_locations": [],
  "categories_for_pickup_locations": [
    "accessories"
  ],
  "weekdays": {
    "orddd_weekday_0": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_1": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_2": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_3": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_4": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_5": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    },
    "orddd_weekday_6": {
      "enable": "checked",
      "additional_charges": "",
      "delivery_charges_label": "Delivery Charges",
      "max_orders": ""
    }
  },
  "holidays": [],
  "specific_dates": []
}

 

7. List all time slots based on the date based on setting ID:

This endpoint will return all the available time slots for the custom setting related to the setting ID.  For example. if we want all the available time slots for 8th July 2021 for the custom setting 33, then we will use – /wp-json/orddd/v1/delivery_schedule/33?date=2021-07-08

Request

GET/wp-json/orddd/v1/delivery_schedule/<setting_id>?date=YYYY-MM-DD
Response
[
  {
    "time_slot": "14:30 - 15:00",
    "time_slot_i18n": "14:30 - 15:00",
    "charges": ""
  },
  {
    "time_slot": "16:00 - 17:00",
    "time_slot_i18n": "16:00 - 17:00",
    "charges": "20"
  }
]

 

8. List the dates based on number of dates & setting ID:

This endpoint will return the next X number of available dates. If we want the next 10 available dates, then use – /wp-json/orddd/v1/delivery_schedule/33?number_of_dates=10

Request

GET/wp-json/orddd/v1/delivery_schedule/<setting_id>?number_of_dates=10
Response
{
  "select": "Select a delivery date",
  "4-2-2022": "4 February, 2022",
  "7-2-2022": "7 February, 2022",
  "9-2-2022": "9 February, 2022",
  "11-2-2022": "11 February, 2022",
  "14-2-2022": "14 February, 2022",
  "16-2-2022": "16 February, 2022",
  "18-2-2022": "18 February, 2022",
  "21-2-2022": "21 February, 2022",
  "23-2-2022": "23 February, 2022",
  "25-2-2022": "25 February, 2022"
}

 

9. /wp-json/orddd/v1/delivery_schedule/?date=<YYYY-MM-DD>&ids=<settings id 1>,<setting id 2>:

This endpoint will return common timeslots from the multiple setting ids provided. This is used specifically when common settings are applied with 2 or more categories or shipping classes.

Request

GET/wp-json/orddd/v1/delivery_schedule/?date=YYYY-MM-DD&ids=<setting_id_1>,<setting_id_2>
Response
[
  {
    "time_slot": "14:30 - 15:00",
    "time_slot_i18n": "14:30 - 15:00",
    "charges": ""
  },
]
Was this article helpful to you? Yes No

How can we help?