The following is a list of all hooks present in the plugin. This list is intended to guide developers who are looking to extend the functionality of Order Delivery Date PRO for WooCommerce plugin.
Admin Settings:
Use the below hooks to perform actions on order delivery date setting in admin.
orddd_include_admin_scripts:
Use this hook to add additional scripts along with the existing scripts used in the plugin
Present in file: order-delivery-date/orddd-scripts.php
Usage:
add_action('orddd_include_admin_scripts','include_new_scripts',10);
Parameters: None
Example:
add_action( 'orddd_include_admin_scripts','include_new_scripts',10 ); function include_new_scripts(){ wp_enqueue_script( 'custom_js_script', plugins_url( '/js/custom_js_script.js', __FILE__ ), '', '', false ); .... }
orddd_plugin_activate:
Use this hook to perform custom action when the plugin is activated.
Present in file: order-delivery-date/order_delivery_date.php
Usage:
<?php add_action('orddd_plugin_activate','plugin_activate',10,1); ?>
Parameters: None
Example:
<?php
add_action('orddd_plugin_activate','plugin_activate',10,1);
function plugin_activate(){
add_option( 'custom_field_name', 'custom_value' );
...
}
orddd_plugin_deactivate:
Use this hook to perform a custom action when the plugin is deleted.
Present in file: order-delivery-date/uninstall.php
Usage:
add_action('orddd_plugin_deactivate','plugin_deactivate',10);
Parameters:None
Example:
add_action('orddd_plugin_deactivate','plugin_deactivate',10); function plugin_deactivate(){ delete_option( 'custom_field_name'); ... }
Frontend Hooks
orddd_include_front_scripts:
Use this hook to add additional scripts on the front end page along with the existing scripts used in the plugin.
Present in file: order-delivery-date/orddd-scripts.php:
Usage:
<?php add_action('orddd_include_front_scripts','include_new_scripts',10,1); ?>
Parameters: None
Example:
<?php
add_action('orddd_include_front_scripts','include_new_scripts',10,1);
function include_new_scripts(){
wp_enqueue_script(
'custom_js_script',
plugins_url( '/js/custom_js_script.js', __FILE__ ),
'',
'',
false );
....
}
orddd_to_calculate_minimum_hours_for_holidays
: Use this hook to enable the calculation of Minimum delivery time (in hours) for holidays on the checkout page.
Present in file: orddd-common.php
Usage:
<?php add_filter( 'orddd_to_calculate_minimum_hours_for_holidays', 'calculate_minimum_hours_for_holidays' ); ?>
Parameters:
None
Example:
<?php add_filter( 'orddd_to_calculate_minimum_hours_for_holidays', 'calculate_minimum_hours_for_holidays' ); function calculate_minimum_hours_for_holidays() { return 'yes'; }
orddd_disable_delivery_for_user_roles:
This hook used to disable delivery date & time field on the checkout page for certain user roles like Subscriber.
Present in file: orddd-locations.php , orddd-process.php , orddd-scripts.php
Usage:
<?php add_filter( 'orddd_disable_delivery_for_user_roles', 'orddd_disable_delivery_for_user_roles_function' ); ?>
Perameters:
$roles – User role array
Example:
<?php add_filter( 'orddd_disable_delivery_for_user_roles', 'orddd_disable_delivery_for_user_roles_function' ); function orddd_disable_delivery_for_user_roles_function($roles) { $roles = array( 'subscriber', 'author', 'customer' ); return $roles; }
orddd_min_delivery_on_last_slot
: Use this hook to calculate the minimum delivery time on the end time of time slot instead of start time.
Present in file: orddd-common.php , orddd-widget.php
Usage:
<?php add_filter( 'orddd_min_delivery_on_last_slot', 'orddd_min_delivery_on_last_slot' ); ?>
Parameters:
$include
Example:
add_filter( ‘orddd_min_delivery_on_last_slot’, ‘orddd_min_delivery_on_last_slot’ );
function orddd_min_delivery_on_last_slot( $include ) {
return true;
}
orddd_overwrite_timeslot_lockout
: Overwrite time slot lockout with Global timeslot field value.
Present in file: orddd-common.php
Usage:
<?php add_filter( 'orddd_overwrite_timeslot_lockout', 'ts_overwrite_timeslot_lockout', 1 ); ?>
Parameters:
$lockout – Global time slot lockout
Example:
<?php add_filter( 'orddd_overwrite_timeslot_lockout', 'ts_overwrite_timeslot_lockout', 1 ); function ts_overwrite_timeslot_lockout( $lockout ) { if ( get_option( 'orddd_global_lockout_time_slots' ) != '0' && get_option( 'orddd_global_lockout_time_slots' ) != '' ) { $lockout = get_option( 'orddd_global_lockout_time_slots' ); } return $lockout; }
orddd_modify_reminder_email_time:
This hook will be used to change delivery reminder email timing for customers.
Present in file: orddd-send-reminder.php
Usage:
<?php add_filter('orddd_modify_reminder_email_time', 'orddd_modify_reminder_email_time', 10, 2); ?>
Parameters:
$time – Email Timing
$timezone – Timezone
Example:
<?php add_filter('orddd_modify_reminder_email_time', 'orddd_modify_reminder_email_time', 10, 2); function orddd_modify_reminder_email_time( $time, $timezone) { return strtotime('10:00:00 '.$timezone); }
orddd_modify_admin_reminder_email_time :
This hook will be used to change delivery reminder email timing for admin.
Present in file: orddd-send-reminder.php
Usage:
<?php add_filter('orddd_modify_admin_reminder_email_time', 'orddd_modify_admin_reminder_email_time', 10, 2); ?>
Parameters:
$time – Email Timing
$timezone – Timezone
Example:
<?php add_filter('orddd_modify_admin_reminder_email_time', 'orddd_modify_admin_reminder_email_time', 10, 2); function orddd_modify_admin_reminder_email_time( $time, $timezone) { return strtotime('10:00:00 '.$timezone); }
orddd_print_columns:
Use this hook to add additional columns in the Print format.
Present in file: order-delivery-date/orddd-view-deliveries.php
Usage:
<?php add_filter( 'orddd_print_columns', 'orddd_print_columns' ); ?>
Parameters:
$columns – Print Columns Data
Example:
add_filter( 'orddd_print_columns', 'orddd_print_columns' ); function orddd_print_columns( $columns ) { $columns = " <tr> <th style='border:1px solid black;padding:5px;'>".__( 'Order ID', 'order-delivery-date' )."</th> <th style='border:1px solid black;padding:5px;'>".__( 'Products', 'order-delivery-date' )."</th> <th style='border:1px solid black;padding:5px;'>".__( 'Billing Address', 'order-delivery-date' )."</th> <th style='border:1px solid black;padding:5px;'>".__( 'Shipping Address', 'order-delivery-date' )."</th> <th style='border:1px solid black;padding:5px;'>".__( 'Shipping Method', 'order-delivery-date' )."</th> <th style='border:1px solid black;padding:5px;'>".__( get_option( 'orddd_location_field_label' ), 'order-delivery-date' )."</th> <th style='border:1px solid black;padding:5px;'>".__( 'Delivery Date', 'order-delivery-date' )."</th> <th style='border:1px solid black;padding:5px;'>".__( 'Delivery Time', 'order-delivery-date' )."</th> <th style='border:1px solid black;padding:5px;'>".__( 'Order Date', 'order-delivery-date' )."</th> <th style='border:1px solid black;padding:5px;'>".__( 'Phone Number', 'order-delivery-date' )."</th> <th style='border:1px solid black;padding:5px;'>".__( 'Order Note', 'order-delivery-date' )."</th> </tr>"; return $columns; }
orddd_print_rows:
Use this hook to add values in raw for added additional columns.
Present in file: order-delivery-date/orddd-view-deliveries.php
Usage:
<?php add_filter( 'orddd_print_rows', 'orddd_print_rows', 10, 2 ); ?>
Parameters:
$rows – Rows data of print format
$data – Order details
Example:
add_filter( 'orddd_print_rows', 'orddd_print_rows', 10, 2 ); function orddd_print_rows( $rows, $data ) { $rows = ''; foreach ( $data as $key => $value ) { // Currency Symbol // The order currency is fetched to ensure the correct currency is displayed if the site uses multi-currencies $the_order = wc_get_order( $value->order_id ); $currency = ( version_compare( WOOCOMMERCE_VERSION, "3.0.0" ) < 0 ) ? $the_order->get_order_currency() : $the_order->get_currency(); $currency_symbol = get_woocommerce_currency_symbol( $currency ); $rows .= "<tr> <td style='border:1px solid black;padding:5px;'>" . $value->order_id . "</td> <td style='border:1px solid black;padding:5px;'>"; foreach( $value->product_name as $id => $data ) { $rows .= $data['product'] . " x " . $data['quantity']."<br>"; } $rows .= "</td> <td style='border:1px solid black;padding:5px;'>" . $value->billing_address . "</td> <td style='border:1px solid black;padding:5px;'>" . $value->shipping_address . "</td> <td style='border:1px solid black;padding:5px;'>" . $value->shipping_method . "</td> <td style='border:1px solid black;padding:5px;'>" . $value->pickup_location . "</td> <td style='border:1px solid black;padding:5px;'>" . $value->delivery_date . "</td> <td style='border:1px solid black;padding:5px;'>" . $value->delivery_time . "</td> <td style='border:1px solid black;padding:5px;'>" . $value->order_date . "</td> <td style='border:1px solid black;padding:5px;'>" . $the_order->get_billing_phone() . "</td> <td style='border:1px solid black;padding:5px;'>" . $the_order->get_customer_note('view') . "</td> </tr>"; } return $rows; }
orddd_csv_data:
Use this hook to customize delivery information in the CSV format which is exported from our plugin.
Present in file: order-delivery-date/orddd-view-deliveries.php
Usage:
<?php add_filter( 'orddd_csv_data', 'orddd_csv_data', 10, 2 ); ?>
Parameters:
$csv – CSV data
$report – Order details
Example:
<?php add_filter( 'orddd_csv_data', 'orddd_csv_data', 10, 2 ); function orddd_csv_data( $csv, $report ) { $csv = 'Order ID,Products,Billing Address,Shipping Address,Shipping Method,' . __( get_option( 'orddd_location_field_label' ), 'order-delivery-date' ) . ',Delivery Date,Delivery Time,Order Date, Phone Number'; $csv .= "\n"; foreach ( $report as $key => $value ) { // Order ID $order_id = $value->order_id; $product_name = $value->product_name; $quantity = $value->quantity; $billing_address = $value->billing_address; $shipping_address = $value->shipping_address; $shipping_method = $value->shipping_method; $pickup_location = $value->pickup_location; $delivery_date = $value->delivery_date; $delivery_time = $value->delivery_time; $order_date = $value->order_date; $product_name = str_replace( '"', '""', $product_name ); $the_order = wc_get_order( $value->order_id ); $order = new WC_Order( $order_id ); $phone = $order->get_billing_phone(); if ( 'product' == $_GET['eventType'] ) { $break = ''; } else { $break = "\n"; } // Create the data row $csv .= $order_id . ',"'; foreach ( $product_name as $id => $data ) { $name = str_replace( ' ', "\n", $data['product'] ); $csv .= strip_tags( $name ) . ' x ' . $data['quantity'] . $break; } // Create the data row $csv .= '","' . $billing_address . '","' . $shipping_address . '","' . $shipping_method . '","' . $pickup_location . '","' . $delivery_date . '","' . $delivery_time . '","' . $order_date . '","' . $phone . '"'; $csv .= "\n"; } return $csv; }
orddd_delivery_modify_calendar_data:
Use this hook to add extra order details in the popup of every event showing on Delivery Calendar page.
Present in file: includes\adminend-events-jsons.php
Usage:
<?php add_filter( 'orddd_delivery_modify_calendar_data', 'orddd_modify_title_data', 10, 2 ); ?>
Parameters:
$calendar_data: Calendar Object
$order: Order Object
Example:
<?php add_filter( 'orddd_delivery_modify_calendar_data', 'orddd_modify_title_data', 10, 2 ); function orddd_modify_title_data( $calendar_data, $order ) { if ( 'order' === $calendar_data['eventtype'] ) { $customer_fullname = $order->get_formatted_billing_full_name(); $calendar_data['title'] = $customer_fullname; } return $calendar_data; }
orddd_modify_calendar_product_info:
Use this hook to modify only product details appearing in detail popup of Delivery Calendar page.
Present in file: orddd-view-deliveries.php
Usage:
<?php add_filter( 'orddd_modify_calendar_product_info', 'orddd_modify_product_details', 10, 2 ); ?>
Parameters:
$item_name: Current Item Name.
$item: Item Array.
Example:
<?php add_filter( 'orddd_modify_calendar_product_info', 'orddd_modify_product_details', 10, 2 ); function orddd_modify_product_details( $item_name, $item ) { $product = wc_get_product( $item['product_id'] ); if ( '' !== $product->get_sku() ) { $item_name .= 'SKU: ' . $product->get_sku() . ''; } return $item_name; }
orddd_add_custom_field_value_to_qtip:
Use this hook to add Title/custom fields of Popup details on Delivery Calendar page.
Present in file: orddd-view-deliveries.php
Usage:
<?php add_filter( 'orddd_add_custom_field_value_to_qtip', 'orddd_add_custom_field_value_to_qtip' ); ?>
Parameters:
$order_id: Order Id.
Example:
<?php add_filter( 'orddd_add_custom_field_value_to_qtip', 'orddd_add_custom_field_value_to_qtip' ); function orddd_add_custom_field_value_to_qtip( $order_id ) { //custom code here $custom_field = ; return $custom_field; }
orddd_gcal_add_product_options:
This hook is used to change “Event Description” field in Google Calendar.
Present in file: includes\class.gcal.php
Usage:
<?php add_filter( 'orddd_add_custom_field_value_to_qtip', 'orddd_add_custom_field_value_to_qtip' ); ?>
Parameters:
$product_name – Product Name
$product_id – Product ID
$item_value – Item details
Example: To make the product options from “Custom Product Options plugin from Acowebs” (https://acowebs.com/woo-custom-product-addons/) visible in the Event Description field.
<?php /** * function for adding product options to google calendar event from the Custom Product Options Pro plugin * * @return string $custom_product_options_data */ add_filter( 'orddd_gcal_add_product_options', 'orddd_add_custom_product_options', 10, 4 ); function orddd_add_custom_product_options( $product_options, $product_name, $product_id, $item_value ) { $custom_product_options_data = ''; $custom_product_option_meta = $item_value->get_meta( '_WCPA_order_meta_data' ); // meta key. $i = 0; foreach ( $custom_product_option_meta as $custom_product_plugin_key => $custom_product_plugin_value ) { $custom_selected_options = ''; if ( 0 === $i ) { $label = $custom_product_plugin_value['label'] . "\r\n"; } else { $label = "\r\n" . $custom_product_plugin_value['label'] . "\r\n"; } foreach ( $custom_product_plugin_value['value'] as $ckey => $cvalue ) { $custom_selected_options .= $cvalue['value'] . "\r\n"; } $custom_product_options_data .= $label . $custom_selected_options; $i++; } return ( '' !== $custom_product_options_data ) ? "\r\n" . $custom_product_options_data : ''; }
orddd_disable_delivery_fields:
This hook is used to disable the delivery fields until ajax is loaded and the necessary address fields are filled up on the checkout page.
Present in file: orddd-common.php
Usage:
<?php add_filter( 'orddd_disable_delivery_fields', 'orddd_disable_delivery_fields_function' ); ?>
Parameters: None
Example:
<?php add_filter( 'orddd_disable_delivery_fields', 'orddd_disable_delivery_fields_function' ); function orddd_disable_delivery_fields_function() { return 'yes'; }
Note: This hook will work when the ‘Custom delivery’ checkbox is enabled in the Custom Delivery Settings tab. Attaching the screenshot for your reference: https://prnt.sc/k7iu1r
orddd_edit_field_for_order_statuses
: This hook will allow the customers to edit the Delivery Date & Time on the My account page only for the selected returned order statuses from this hook
Present in file: orddd-process.php
Usage:
<?php add_filter( 'orddd_edit_field_for_order_statuses', 'orddd_edit_field_for_order_statuses_function' ); ?>
Parameters:
None
Example:
<?php add_filter( 'orddd_edit_field_for_order_statuses', 'orddd_edit_field_for_order_statuses_function' ); function orddd_edit_field_for_order_statuses_function() { $order_statuses_arr = array( 'wc-on-hold', 'wc-pending' ); return $order_statuses_arr; }
orddd_custom_date_formats
: This hook will allow the customers to add the Custom Date Formats for delivery date.
Present in file: order_delivery_date.php
Usage:
<?php add_filter('orddd_custom_date_formats', 'orddd_custom_date_formats_callback', 10, 1); ?>
Parameters:
$date_formats – Delivery Date Format
Example:
<?php add_filter('orddd_custom_date_formats', 'orddd_custom_date_formats_callback', 10, 1); function orddd_custom_date_formats_callback( $date_formats ) { $date_formats['d-m-y'] = 'd-m-y'; return $date_formats; }
orddd_modify_select_dropdown_text
: This filter to allow to change the default text ‘Select a Delivery Date’ showing for the delivery date selection dropdown.
Present in file: class-orddd-functions.php
Usage:
<?php add_filter('orddd_modify_select_dropdown_text','orddd_modify_select_dropdown_text'); ?>
Parameters:
$text – Default Text ‘Select a delivery date’ showing in dropdown list.
Example:
<?php add_filter('orddd_modify_select_dropdown_text','orddd_modify_select_dropdown_text'); function orddd_modify_select_dropdown_text( $text ) { return 'Select a Delivery/Pickup Date'; }
orddd_before_checkout_delivery_date
: Use this hook to add new fields before the Delivery date field on checkout page.
Present in file: orddd-process.php
Usage:
<?php add_action('orddd_before_checkout_delivery_date','add_new_field_before',10,1); ?>
Parameters:None
Example:
<?php add_action('orddd_before_checkout_delivery_date','add_new_field_before',10,1); function add_new_field_before(){ ... }
orddd_before_checkout_time_slot:
Use this hook to add new fields before the Time slot field on the checkout page.
Present in file: orddd-process.php
Usage:
<?php add_action('orddd_before_checkout_time_slot','add_new_field_before',10,1); ?>
Parameters:
$checkout – Object
Example:
<?php add_action('orddd_before_checkout_time_slot','add_new_field_before',10,1); function add_new_field_before($checkout){ ... }
orddd_after_checkout_delivery_date: Use this hook to add new fields after the Delivery date field on checkout page.
Present in file: orddd-process.php
Usage:
<?php add_action('orddd_after_checkout_delivery_date','add_new_field_after',10,1); ?>
Parameters:
$checkout – Object
Example:
<?php add_action('orddd_after_checkout_delivery_date','add_new_field_after',10,1); function add_new_field_after($checkout){ ... }
orddd_after_checkout_time_slot:
Use this hook to add new fields after the Time slot field on checkout page.
Present in file: orddd-process.php
Usage:
<?php add_action('orddd_after_checkout_time_slot','add_new_field_after',10,1); ?>
Parameters:
$checkout – Object
Example:
<?php add_action('orddd_after_checkout_time_slot','add_new_field_after',10,1); function add_new_field_after($checkout ){ ... }
orddd_before_date_validation
Use this hook to perform any action before mandatory field validation of date takes place on checkout page before order is placed.
Present in file: orddd-process.php
Usage:
<?php add_action('orddd_before_date_validation','date_processing_function',10,1); ?>
Parameters:
$orddd_delivery_date – This contains the date selected from delivery date field.
Example:
<?php add_action('orddd_before_date_validation','date_processing_function',10,1); function date_processing_function($orddd_delivery_date){ /* perform your custom validation action with delivery date selected before any other validations happen*/ if($orddd_delivery_date == "" ) { /* example some javascript alert action */ } ... }
orddd_after_date_validation
: Use this hook to perform any action after mandatory field validation of date takes place on checkout page before order is placed.
Present in file: orddd-process.php
Usage:
<?php add_action('orddd_after_date_validation','date_processing_function',10,1); ?>
Parameters:
$orddd_delivery_date – This contains the date selected from delivery date field.
Example:
<?php add_action('orddd_after_date_validation','date_processing_function',10,1); function date_processing_function($delivery_date){ /* perform your action with delivery date selected after mandatory field validation completed sucessfully*/ /* example save Delivery Date in your custom table */ ... }
orddd_before_timeslot_validation:
Use this hook to perform any action before mandatory field validation of timeslot takes place on checkout page before order is placed.
Present in file: orddd-process.php
Usage:
<?php add_action('orddd_before_timeslot_validation','timeslot_processing_function',10,1); ?>
Parameters:
$orddd_timeslot – This contains the time slot selected from time slot field.
Example:
<?php add_action('orddd_before_timeslot_validation','timeslot_processing_function',10,1); function timeslot_processing_function($orddd_timeslot){ /* perform your custom validation action with timeslot selected before any other validations happen*/ if($orddd_timeslot == "" || $orddd_timeslot == 'choose' || $orddd_timeslot == 'NA' ) { /* example some javascript alert action */ } ... }
orddd_after_timeslot_validation:
Use this hook to perform any action after mandatory field validation of timeslot takes place on checkout page before order is placed.
Present in file: orddd-process.php
Usage:
<?php add_action('orddd_after_timeslot_validation','timeslot_processing_function',10,1); ?>
Parameters:
$orddd_timeslot – This contains the time slot selected from time slot field.
Example:
<?php add_action('orddd_after_timeslot_validation','timeslot_processing_function',10,1); function timeslot_processing_function($orddd_timeslot){ /* perform your action with timeslot selected after mandatory field validation completed sucessfully*/ /* example save Timeslots in your custom table */ ... }
orddd_after_delivery_date_update:
Use this hook to perform custom action after Delivery Date information is updated in database.
Present in file: orddd-process.php
Usage:
<?php add_action('orddd_after_delivery_date_update','process_date_after_update',10,1); ?>
Parameters:
$orddd_delivery_date- This contains the delivery date selected from delivery date field.
Example:
<?php add_action('orddd_after_delivery_date_update','process_date_after_update',10,1); function process_date_after_update($orddd_delivery_date){ /*store the delivery date in some custom table for later processing*/ ... }
orddd_after_timeslot_update:
Use this hook to perform custom action after Timeslot information is updated in database.
Present in file: orddd-process.php
Usage:
<?php add_action('orddd_after_timeslot_update','process_timeslot_after_update',10,1); ?>
Parameters:
$orddd_timeslot – This contains the time slot selected from time slot field.
Example:
<?php add_action('orddd_after_timeslot_update','process_timeslot_after_update',10,1); function process_timeslot_after_update($orddd_timeslot){ /*store the timeslot in some custom table for later processing*/ ... }
orddd_add_delivery_date_fees
: Use this hook to add additional fee along with delivery fees.
Present in file: orddd-process.php
Usage:
<?php add_filter('orddd_add_delivery_date_fees','add_additional_charges',10,2); ?>
Parameters:
$order_delivery_date – This contains the delivery date selected on the checkout page.
$orddd_fees – This contains the delivery charges added for the selected date in admin panel.
Example:
<?php add_filter('orddd_add_delivery_date_fees','add_additional_charges',10,2); function add_additional_charges($order_delivery_date, $orddd_fees){ //Calculate the addition charges with delivery fees..... return $orddd_fees; }
orddd_email_before_delivery_date
: Use this hook to add new fields in an email before the Delivery Date plugin fields, on placing the order.
Present in file: orddd-process.php
Usage:
<?php add_filter('orddd_email_before_delivery_date','add_new_field_before',10,1); ?>
Parameters:
$keys – This is the default value used for adding fields in emails
Example:
<?php
add_filter( 'orddd_email_before_delivery_date' , 'orddd_email_before_delivery_date' ); function orddd_email_before_delivery_date( $fields ) { $fields['orddd_title'] = array( 'label' => 'Delivery Date', 'value' => 'Details', ); return $fields; }
orddd_email_after_delivery_details
: Use this hook to add new fields in an email after the Delivery Date plugin fields, on placing the order.
Present in file: orddd-process.php
Usage:
<?php add_filter('orddd_email_after_delivery_details','add_new_field_after',10,1); ?>
Parameters:
$keys – This is the default value used for adding fields in emails
Example:
<?php add_filter('orddd_email_after_delivery_details','add_new_field_after',10,1); function add_new_field_after($keys){ $keys[] = 'Custom field'; return $keys; }
orddd_before_delivery_date_update
: Use this hook to perform custom action before Delivery Date information is updated in database.
Present in file: orddd-process.php
Usage:
<?php add_filter('orddd_before_delivery_date_update','modify_date_before_update',10,1); ?>
Parameters:
$orddd_delivery_date – This contains the delivery date selected from delivery date field.
Example:
<?php add_filter('orddd_before_delivery_date_update','modify_date_before_update',10,1); function modify_date_before_update($orddd_delivery_date){ /*modify the delivery date to be saved if cart contains some products or products from certain categories*/ return $orddd_delivery_date; }
orddd_before_timeslot_update
: Use this hook to perform custom action before Timeslot information is updated in database.
Present in file: orddd-process.php
Usage:
<?php add_filter('orddd_before_timeslot_update','modify_timeslot_before_update',10,1); ?>
Parameters:
$orddd_timeslot – This contains the time slot selected from time slot field.
Example:
<?php add_filter('orddd_before_timeslot_update','modify_timeslot_before_update',10,1); function modify_timeslot_before_update($orddd_timeslot){ /*modify the delivery timeslot to be saved if cart contains some products or products from certain categories*/ return $orddd_timeslot; }
orddd_remove_delivery_date_if_product_category_no
: Use this hook to disable the Delivery fields on the checkout page if any of the product with the category which has Delivery disabled is added to the cart.
Present in file: orddd-common.php , integration.php , orddd-process.php
Usage:
<?php add_filter( 'orddd_remove_delivery_date_if_product_category_no', 'remove_delivery_date_if_product_category_no' ); ?>
Parameters:
None
Example:
<?php add_filter( 'orddd_remove_delivery_date_if_product_category_no', 'remove_delivery_date_if_product_category_no' ); function remove_delivery_date_if_product_category_no() { return 'yes'; }
orddd_add_delivery_charges_for_free_coupon_code: This hook allows adding delivery charges for the date even if the coupon code with Free Shipping is used on the checkout page.
Present in file: orddd-process.php, orddd-admin-delivery.php
Usage:
<?php add_filter( 'orddd_to_add_delivery_charges_for_free_coupon_code', 'add_delivery_charges_for_free_coupon_code' ); ?>
Parameters:
None
Example:
<?php add_filter( 'orddd_to_add_delivery_charges_for_free_coupon_code', 'add_delivery_charges_for_free_coupon_code' ); function add_delivery_charges_for_free_coupon_code() { return 'yes'; }
Settings Api Sections for WooCommerce Delivery Date Functions:
Use the below sections to add new fields at appropriate tabs within the order delivery date setting in admin.
orddd_date_settings_section
: Use this section to add new field/s in ‘Order Delivery Date Settings’ section in Date settings tab.
Present in file: orddd-settings.php
Usage:
<?php add_action( 'admin_init', 'orddd_new_date_settings'); function orddd_new_date_settings() { add_settings_field( 'orddd_custom_field', 'Custom Field:', 'orddd_custom_field_callback', 'orddd_date_settings_page', 'orddd_date_settings_section', array( 'Custom field' ) ); register_setting( 'orddd_date_settings', 'orddd_custom_field' ); } function orddd_custom_field_callback( $args ) { printf( '<input type="text" name="orddd_custom_field" id="orddd_custom_field" value="'.get_option( 'orddd_custom_field' ).'" maxlength="40"/>' ); $html = '<label for="orddd_custom_field"> ' . $args[0] . '</label>'; echo $html; }
orddd_integration_with_other_plugins
: Use this section to add new field/s in ‘Integration with Other Plugins’ section in Date settings tab.
Present in file: orddd-settings.php
Usage:
<?php add_action( 'admin_init', 'orddd_new_date_settings',15); function orddd_new_date_settings() { add_settings_field( 'orddd_custom_field', 'Custom Field:', 'orddd_custom_field_callback', 'orddd_date_settings_page', 'orddd_integration_with_other_plugins', array( 'Custom field' ) ); register_setting( 'orddd_date_settings', 'orddd_custom_field' ); } function orddd_custom_field_callback( $args ) { printf( '<input type="text" name="orddd_custom_field" id="orddd_custom_field" value="'.get_option( 'orddd_custom_field' ).'" maxlength="40"/>' ); $html = '<label for="orddd_custom_field"> ' . $args[0] . '</label>'; echo $html; }
orddd_time_settings_section: Use this section to add new field/s in ‘Time Settings’ section in Time settings tab.
Present in file: orddd-settings.php
Usage:
<?php add_action( 'admin_init', 'orddd_new_time_settings',15); function orddd_new_time_settings() { add_settings_field( 'orddd_custom_field', 'Custom Field:', 'orddd_custom_field_callback', 'orddd_time_settings_page', 'orddd_time_settings_section', array( 'Custom field' ) ); register_setting( 'orddd_time_settings', 'orddd_custom_field' ); } function orddd_custom_field_callback( $args ) { printf( '<input type="text" name="orddd_custom_field" id="orddd_custom_field" value="'.get_option( 'orddd_custom_field' ).'" maxlength="40"/>' ); $html = '<label for="orddd_custom_field"> ' . $args[0] . '</label>'; echo $html; }
orddd_same_day_delivery_section
: Use this section to add new field/s in ‘Same Day Delivery’ section in Time settings tab.
Present in file: orddd-settings.php
Usage:
<?php add_action( 'admin_init', 'orddd_new_time_settings',15); function orddd_new_time_settings() { add_settings_field( 'orddd_custom_field', 'Custom Field:', 'orddd_custom_field_callback', 'orddd_time_settings_page', 'orddd_same_day_delivery_section', array( 'Custom field' ) ); register_setting( 'orddd_time_settings', 'orddd_custom_field' ); } function orddd_custom_field_callback( $args ) { printf( '<input type="text" name="orddd_custom_field" id="orddd_custom_field" value="'.get_option( 'orddd_custom_field' ).'" maxlength="40"/>' ); $html = '<label for="orddd_custom_field"> ' . $args[0] . '</label>'; echo $html; }
orddd_next_day_delivery_section: Use this section to add new field/s in ‘Next Day Delivery’ section in Time settings tab.
Present in file: orddd-settings.php
Usage:
<?php add_action( 'admin_init', 'orddd_new_time_settings',15); function orddd_new_time_settings() { add_settings_field( 'orddd_custom_field', 'Custom Field:', 'orddd_custom_field_callback', 'orddd_time_settings_page', 'orddd_next_day_delivery_section', array( 'Custom field' ) ); register_setting( 'orddd_time_settings', 'orddd_custom_field' ); } function orddd_custom_field_callback( $args ) { printf( '<input type="text" name="orddd_custom_field" id="orddd_custom_field" value="'.get_option( 'orddd_custom_field' ).'" maxlength="40"/>' ); $html = '<label for="orddd_custom_field"> ' . $args[0] . '</label>'; echo $html; }
orddd_holidays_section
: Use this section to add new field/s in ‘Add Holiday’ section in Holidays tab.
Present in file: orddd-settings.php
Usage:
<?php add_action( 'admin_init', 'orddd_new_holiday_settings',15); function orddd_new_holiday_settings() { add_settings_field( 'orddd_custom_field', 'Custom Field:', 'orddd_custom_field_callback', 'orddd_holidays_page', 'orddd_holidays_section', array( 'Custom field' ) ); register_setting( 'orddd_holiday_settings', 'orddd_custom_field' ); } function orddd_custom_field_callback( $args ) { printf( '<input type="text" name="orddd_custom_field" id="orddd_custom_field" value="'.get_option( 'orddd_custom_field' ).'" maxlength="40"/>' ); $html = '<label for="orddd_custom_field"> ' . $args[0] . '</label>'; echo $html; }
orddd_appearance_section
: Use this section to add new field/s in ‘Calendar Apprearance’ section in Holidays tab.
Present in file: orddd-settings.php
Usage:
<?php add_action( 'admin_init', 'orddd_new_appearance_settings',15); function orddd_new_appearance_settings() { add_settings_field( 'orddd_custom_field', 'Custom Field:', 'orddd_custom_field_callback', 'orddd_appearance_page', 'orddd_appearance_section', array( 'Custom field' ) ); register_setting( 'orddd_appearance_settings', 'orddd_custom_field' ); } function orddd_custom_field_callback( $args ) { printf( '<input type="text" name="orddd_custom_field" id="orddd_custom_field" value="'.get_option( 'orddd_custom_field' ).'" maxlength="40"/>' ); $html = '<label for="orddd_custom_field"> ' . $args[0] . '</label>'; echo $html; }
orddd_delivery_days_section
: Use this section to add new field/s in ‘Add Specific Delivery Dates’ section in Holidays tab.
Present in file: orddd-settings.php
Usage:
<?php add_action( 'admin_init', 'orddd_new_delivery_date_settings',15); function orddd_new_delivery_date_settings() { add_settings_field( 'orddd_custom_field', 'Custom Field:', 'orddd_custom_field_callback', 'orddd_delivery_days_page', 'orddd_delivery_days_section', array( 'Custom field' ) ); register_setting( 'orddd_delivery_days_settings', 'orddd_custom_field' ); } function orddd_custom_field_callback( $args ) { printf( '<input type="text" name="orddd_custom_field" id="orddd_custom_field" value="'.get_option( 'orddd_custom_field' ).'" maxlength="40"/>' ); $html = '<label for="orddd_custom_field"> ' . $args[0] . '</label>'; echo $html; }
orddd_time_slot_section
: Use this section to add new field/s in ‘Time Slot Settings’ section in Holidays tab.
Present in file: orddd-settings.php
Usage:
<?php add_action( 'admin_init', 'orddd_new_time_slot_settings',15); function orddd_new_time_slot_settings() { add_settings_field( 'orddd_custom_field', 'Custom Field:', 'orddd_custom_field_callback', 'orddd_time_slot_page', 'orddd_time_slot_section', array( 'Custom field' ) ); register_setting( 'orddd_time_slot_settings', 'orddd_custom_field' ); } function orddd_custom_field_callback( $args ) { printf( '<input type="text" name="orddd_custom_field" id="orddd_custom_field" value="'.get_option( 'orddd_custom_field' ).'" maxlength="40"/>' ); $html = '<label for="orddd_custom_field"> ' . $args[0] . '</label>'; echo $html; }
WooCommerce Delivery Date Functions:
orddd_get_order_delivery_date
: Use this function to obtain Delivery Date information for a particular order.
Present in file: orddd-common.php
Usage:
<?php $order_id = 786; /*sample order ID*/ $orddd_class = new orddd_common(); $delivery_date = $orddd_class->orddd_get_order_delivery_date($order_id); ?>
Parameters:
$order_id – This contains the order id for which delivery date is obtained.
orddd_get_order_timeslot
: Use this function to obtain Time slot information for a particular order.
Present in file: orddd-common.php
Usage:
<?php $order_id = 786; /*sample order ID*/ $orddd_class = new orddd_common(); $time_slot= $orddd_class->orddd_get_order_timeslot($order_id); ?>
Parameters:
$order_id – This contains the order id for which time slot is obtained.