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.
How can I add custom scripts along with the existing scripts used in the plugin?
Hook:
orddd_include_admin_scripts:
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 ); .... }
How can I perform a custom action when the plugin is activated?
Hook:
orddd_plugin_activate
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' );
...
}
How can I perform a custom action when the plugin is deactivated?
Hook:
orddd_plugin_deactivate
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
How to add additional scripts on the front end page along with the existing scripts used in the plugin?
Hook:
orddd_include_front_scripts
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 );
....
}
How to enable the calculation of Minimum delivery time (in hours) for holidays on the Checkoout page?
Hook:
orddd_to_calculate_minimum_hours_for_holidays
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'; }
How to disable delivery date & time field on the checkout page for certain user roles like Subscriber?
Hook:
orddd_disable_delivery_for_user_roles
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; }
How to calculate the minimum delivery time on the end time of time slot instead of start time?
Hook:
orddd_min_delivery_on_last_slot
Usage:
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;
}
Can I overwrite time slot lockout with Global timeslot field value?
Hook:
orddd_overwrite_timeslot_lockout
Usage:
add_filter( 'orddd_overwrite_timeslot_lockout', 'ts_overwrite_timeslot_lockout', 1 ); ?>
Parameters:
$lockout – Global time slot lockout
Example:
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; }
How can I change delivery reminder email timing for customers?
Hook:
orddd_modify_reminder_email_time
Usage:
add_filter('orddd_modify_reminder_email_time', 'orddd_modify_reminder_email_time', 10, 2); ?>
Parameters:
$time – Email Timing
$timezone – Timezone
Example:
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); }
How can I change delivery reminder email timing which is sent to admin?
Hook:
orddd_modify_admin_reminder_email_time
Usage:
add_filter('orddd_modify_admin_reminder_email_time', 'orddd_modify_admin_reminder_email_time', 10, 2); ?>
Parameters:
$time – Email Timing
$timezone – Timezone
Example:
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); }
How can I add additional columns in the Print format?
Hook:
orddd_print_columns
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; }
How can I add values in raw for additional columns in the Print format?
Hook:
orddd_print_rows
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; }
Can I customize delivery information in the CSV format which is exported within this plugin?
Hook:
orddd_csv_data
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; }
Can I add additional order details in the popup of every event showing on Admin Delivery Calendar View page?
Hook:
orddd_delivery_modify_calendar_data
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; }
How to modify only product details appearing in detail popup on Admin Delivery Calendar View page?
Hook:
orddd_modify_calendar_product_info
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; }
Can I add Title/custom fields of Popup details on Admin Delivery Calendar View page?
Hook:
orddd_add_custom_field_value_to_qtip:
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; }
Can I change “Event Description” field in Google Calendar?
Hook:
orddd_gcal_add_product_options
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-gcal-set_description:
This hook is used to modify the Google Calendar even description. The event description is passed through this filter before sending to the google calendar.
Usage:
add_filter( 'orddd-gcal-set_description', 'orddd_gcal_set_description', 10, 2 );
Parameters: None
Example:
<?php add_filter( 'orddd-gcal-set_description', 'orddd_gcal_set_description', 10, 2 ); function orddd_gcal_set_description( $desc, $order_id ) { // write the code here for adding additional information $additional = 'additional info here'; $desc .= $additional; }
How can I disable the delivery fields until ajax is loaded and the necessary address fields are filled up on the checkout page?
Hook: orddd_disable_delivery_fields
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
Can I allow the customers to edit the Delivery Date & Time on the My account page only for the specific returned order statuses?
Hook:
orddd_edit_field_for_order_statuses
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; }
Can I allow the customers to add the Custom Date Formats for delivery date?
Hook: orddd_custom_date_formats
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; }
How to change the default text ‘Select a Delivery Date’ showing for the delivery date selection dropdown?
Hook:
orddd_modify_select_dropdown_text
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'; }
How to add new fields before the Delivery date field on checkout page?
Hook:
orddd_before_checkout_delivery_date
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(){ ... }
Can I add new fields before the Time slot field on the checkout page?
Hook:
orddd_before_checkout_time_slot
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){ ... }
Can I add new fields after the Delivery date field on checkout page?
Hook: orddd_after_checkout_delivery_date
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){ ... }
How can I add new fields after the Time slot field on checkout page?
Hook:orddd_after_checkout_time_slot
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 ){ ... }
How can I make the changes to perform any action before mandatory field validation of date takes place on checkout page before order is placed?
Hook:
orddd_before_date_validation
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 */ } ... }
How can I make the changes to perform any action after mandatory field validation of date takes place on checkout page before order is placed?
Hook:
orddd_after_date_validation
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 */ ... }
How can I make the changes to perform any action before mandatory field validation of timeslot takes place on checkout page before order is placed?
Hook: orddd_before_timeslot_validation
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 */ } ... }
How can I make the changes to perform any action after mandatory field validation of timeslot takes place on checkout page before order is placed?
Hook:
orddd_after_timeslot_validation
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 */ ... }
How can I make the changes to perform custom action after Delivery Date information is updated in database?
Hook: orddd_after_delivery_date_update
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*/ ... }
How can I make the changes to perform custom action after Time Slot information is updated in database?
Hook:
orddd_after_timeslot_update
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*/ ... }
How can I add additional fee along with delivery fees?
Hook:
orddd_add_delivery_date_fees
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; }
How can I add new fields in an email before the Delivery Date plugin fields, on placing the order?
Hook:
orddd_email_before_delivery_date
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; }
How can I add new fields in an email after the Delivery Date plugin fields, on placing the order?
Hook:
orddd_email_after_delivery_details
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; }
How to perform custom action before Delivery Date information is updated in database?
Hook:
orddd_before_delivery_date_update
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; }
How perform custom action before Time Slot information is updated in database?
Hook:
orddd_before_timeslot_update
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; }
How 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?
Hook:
orddd_remove_delivery_date_if_product_category_no
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'; }
How to allow delivery charges for the date even if the coupon code with Free Shipping is used on the checkout page?
Hook:
orddd_add_delivery_charges_for_free_coupon_code
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'; }
How to add different Business Opening hours for some weekdays?
Hook:
orddd_modify_weekday_opening_time
: Add
Usage
add_filter( 'orddd_modify_weekday_opening_time', 'orddd_modify_weekday_opening_time' );
Parameters:
$arr – This contains the array of weekdays.
Example:
<?php add_filter( 'orddd_modify_weekday_opening_time', 'orddd_modify_weekday_opening_time' ); function orddd_modify_weekday_opening_time( $arr ) { return array( 'weekday' => array('Thursday'), 'opening_time' => '10:00 AM' ); }
How to add different Business Closing hours for some weekdays?
Hoo:
orddd_modify_weekday_closing_time
Usage:
add_filter( 'orddd_modify_weekday_closing_time', 'orddd_modify_weekday_closing_time' );
Parameters:
$arr – This contains the array of weekdays.
Example:
<?php add_filter( 'orddd_modify_weekday_closing_time', 'orddd_modify_weekday_closing_time' ); function orddd_modify_weekday_closing_time( $arr ) { return array( 'weekday' => array('Thursday'), 'closing_time' => '3:00 PM' ); }
How to consider the earliest same day cut off time?
Hook:
orddd_get_lowest_same_day
Usage:
add_filter('orddd_get_lowest_same_day', 'orddd_get_lowest_same_day' );
Parameters:
$bool- boolean
Example:
<?php add_filter('orddd_get_lowest_same_day', 'orddd_get_lowest_same_day' ); function orddd_get_lowest_same_day( $bool ) { return true; }
How to consider the earliest next day cut off time?
Hook:
orddd_get_lowest_next_day
Usage:
add_filter('orddd_get_lowest_next_day', 'orddd_get_lowest_next_day' );
Parameters:
$bool- boolean
Example:
<?php add_filter('orddd_get_lowest_next_day', 'orddd_get_lowest_next_day' ); function orddd_get_lowest_next_day( $bool ) { return true; }
How can I modify validation message when a date is locked out fully and not available for booking?
Hook:
orddd_unavailable_message_for_lockout
:
Usage:
add_filter( 'orddd_unavailable_message_for_lockout', 'orddd_unavailable_message_for_lockout_callback', 10, 3 );
Parameters:
$message – notice message to be appeared on checkout page
$date – Delivery Date
Example:
<?php add_filter( 'orddd_unavailable_message_for_lockout', 'orddd_unavailable_message_for_lockout_callback', 10, 3 ); function orddd_unavailable_message_for_lockout_callback( $message, $date, $category_name ){ if ( empty( $category_name ) ) { return; } $message = sprintf( __( '%1s is not available for delivery on %2s. Please select a new delivery date.', 'order-delivery-date' ), $categories_names_str, $orddd_formatted_date ); return $message; }
How can I modify validation message which shows the available deliveries for a date?
Hook:
orddd_deliveries_message_for_quantities_of_date
Usage:
add_filter( 'orddd_deliveries_message_for_quantities_of_date', 'orddd_deliveries_message_for_quantities_of_date_callback', 10, 4 );
Parameters:
$message – notice message to be appeared on checkout page
$date – Delivery Date
$category_name – Product Category
$quantity – Product Quantity
Example:
<?php add_filter( 'orddd_deliveries_message_for_quantities_of_date', 'orddd_deliveries_message_for_quantities_of_date_callback', 10, 4 ); function orddd_deliveries_message_for_quantities_of_date_callback( $message, $date, $category_name, $quantity ){ if ( empty( $category_name ) ) { return; } $message = sprintf( __( '%1$s has only %2$s deliveries available on %3$s.', 'order-delivery-date' ), $category_name, $quantity, $date ); return $message; }
How can I modify validation message which shows the available deliveries for a specific date?
Hook:
orddd_deliveries_message_for_quantities_of_specific_date
Usage:
add_filter( 'orddd_deliveries_message_for_quantities_of_specific_date', 'orddd_deliveries_message_for_quantities_of_specific_date_callback', 10, 4 );
Parameters:
$message – notice message to be appeared on checkout page
$date – Delivery Date
$category_name – Product Category
$quantity – Product Quantity
Example:
<?php add_filter( 'orddd_deliveries_message_for_quantities_of_specific_date', 'orddd_deliveries_message_for_quantities_of_specific_date_callback', 10, 4 ); function orddd_deliveries_message_for_quantities_of_specific_date_callback( $message, $date, $category_name, $quantity ){ if ( empty( $category_name ) ) { return; } $message = sprintf( __( '%1$s has only %2$s deliveries available on %3$s.', 'order-delivery-date' ), $category_name, $quantity, $date ); return $message; }
How can I modify validation message when a specific date is locked out fully and not available for booking?
Hook:
orddd_unavailable_message_when_no_quantity_of_specific_date
Usage:
add_filter( 'orddd_unavailable_message_when_no_quantity_of_specific_date', 'orddd_unavailable_message_when_no_quantity_of_specific_date_callback', 10, 3 );
Parameters:
$message – notice message to be appeared on checkout page
$date – Delivery Date
$category_name – Product Category
Example:
<?php add_filter( 'orddd_unavailable_message_when_no_quantity_of_specific_date', 'orddd_unavailable_message_when_no_quantity_of_specific_date_callback', 10, 3 ); function orddd_unavailable_message_when_no_quantity_of_specific_date_callback( $message, $date, $category_name ){ if ( empty( $category_name ) ) { return; } $message = sprintf( __( '%1$s has no deliveries left on %2$s. Please select a new delivery date.', 'order-delivery-date' ), $category_name, $date ); return $message; }
How can I modify validation message which shows the available deliveries for a time slot?
Hook:
orddd_deliveries_message_for_timeslots
Usage:
add_filter( 'orddd_deliveries_message_for_timeslots', 'orddd_deliveries_message_for_timeslots_callback', 10, 5 );
Parameters:
$message – notice message to be appeared on checkout page
$date – Delivery Date
$time_slot – Time Slot
$category_name – Product Category
Example:
<?php
add_filter( ‘orddd_deliveries_message_for_timeslots’, ‘orddd_deliveries_message_for_timeslots_callback’, 10, 5 );
function orddd_deliveries_message_for_timeslots_callback( $message, $date, $category_name, $quantity, $time_slot ){
if ( empty( $category_name ) ) {
return;
}
$message = sprintf( __( ‘%1$s has %2$s deliveries left on %3$s for time %4$s.’, ‘order-delivery-date’ ), $category_name, $quantity, $date, $time_slot );
return $message;
}
How can I modify validation message when a time slot is locked out fully and not available for booking?
Hook:
orddd_unavailable_message_for_timeslots
Usage:
add_filter( 'orddd_unavailable_message_for_timeslots', 'orddd_unavailable_message_for_timeslots_callback', 10, 4 );
Parameters:
$message – notice message to be appeared on checkout page
$date – Delivery Date
$time_slot – Time Slot
$category_name – Product Category
Example:
<?php
add_filter( 'orddd_unavailable_message_for_timeslots', 'orddd_unavailable_message_for_timeslots_callback', 10, 4 ); function orddd_unavailable_message_for_timeslots_callback( $message, $date, $category_name, $time_slot ){ if ( empty( $category_name ) ) { return; } $message = sprintf( __( '%1$s is not available for the delivery on %2$s for time %3$s.', 'order-delivery-date' ), $category_name, $date, $time_slot ); return $message; }
How can I export the events for specific order statuses?
Hook:
orddd_export_order_statuses
Usage:
add_filter( 'orddd_export_order_statuses' , 'orddd_export_order_statuses');
Parameters:
$status – Order Status
Example:
<?php
add_filter( 'orddd_export_order_statuses' , 'orddd_export_order_statuses'); function orddd_export_order_statuses( $status ) { return array( 'processing', 'completed', 'pending' ); }
How can I change the “select a delivery date” text when delivery dates are displayed as a dropdown select input?
Hook:
orddd_modify_select_dropdown_text
Usage:
add_filter( 'orddd_modify_select_dropdown_text', 'orddd_modify_select_dropdown_text' );
Parameters:
$text – label
Example:
<?php
add_filter( 'orddd_modify_select_dropdown_text', 'orddd_modify_select_dropdown_text' ); function orddd_modify_select_dropdown_text($text) { return __( 'Pickup Date', 'order-delivery-date' ); // Change Pickup Date to required label }
How to modify localization text on calendar?
Hook:
orddd_modify_jsargs
Usage:
add_filter( 'orddd_modify_jsargs', 'orddd_modify_jsargs' );
Parameters:
$jsArgs – Argument
Example:
?php function orddd_modify_jsargs( $jsArgs ) { $jsArgs['cutOffTimeText'] = __( 'New cutoff time text' ); $jsArgs['emptyListText'] = __( 'Select a date to see time slots available' ); 'NAText' = __( 'Some text for No time slots are available'), 'bookedText' = __( 'Some text for Booked' ), 'cutOffTimeText' = __( 'New text for Cut-off text' ), 'success_delivery_date_message' = __( '<b>New text for Successfully edited the delivery date. Please wait until the page reloads.</b>'), 'emptyListText' => __( 'New text for Select a date to view time slots' ) return $jsArgs; }
Can I consider the lowest minimum delivery time from different custom settings of product categories?
Hook:
orddd_consider_lowest_mdt
Usage:
add_filter( 'orddd_consider_lowest_mdt', '__return_true' );
How can I keep dates available from current week only in delivery calendar?
Hook:
orddd_get_dates_from_current_week
Usage:
add_filter( 'orddd_get_dates_from_current_week', 'orddd_get_dates_from_current_week' );
Example:
<?php add_filter( 'orddd_get_dates_from_current_week', 'orddd_get_dates_from_current_week' ); function orddd_get_dates_from_current_week( $to_apply ) { return true; }
How can I apply sameday cut-off while calculating cut-off for next day when current day is holiday?
Hook:
orddd_consider_holiday_for_sameday_cutoff
Usage:
add_filter( 'orddd_get_dates_from_current_week', 'orddd_get_dates_from_current_week' );
Parameters:
$return – false
Example:
<?php add_filter( 'orddd_consider_holiday_for_sameday_cutoff', 'orddd_consider_holiday_for_sameday_cutoff' ); function orddd_consider_holiday_for_sameday_cutoff( $return = false ) { return true; }
How can I apply nextday while calculating cut-off for next day when it is holiday?
Hook:
orddd_consider_holiday_for_nextday_cutoff
Usage:
add_filter( 'orddd_consider_holiday_for_nextday_cutoff', 'orddd_consider_holiday_for_nextday_cutoff' );
Parameters:
$return – false
Example:
add_filter( 'orddd_consider_holiday_for_nextday_cutoff', 'orddd_consider_holiday_for_nextday_cutoff' ); function orddd_consider_holiday_for_nextday_cutoff( $return = false ) { return true; }
Can I skip lockout calculations for overlapping timeslots?
Hook:
orddd_skip_overlap_timeslot_lockout_calculation
Usage:
add_filter( 'orddd_skip_overlap_timeslot_lockout_calculation', function(){ return true; });
Note: The below solutions work only for future dates that are not blocked yet.
How can I apply nextday while calculating cut-off for next day when it is holiday?
Hook:
orddd_consider_holiday_for_nextday_cutoff
Usage:
add_filter( 'orddd_consider_holiday_for_nextday_cutoff', 'orddd_consider_holiday_for_nextday_cutoff' );
Parameters:
$return – false
Example:
add_filter( 'orddd_consider_holiday_for_nextday_cutoff', 'orddd_consider_holiday_for_nextday_cutoff' ); function orddd_consider_holiday_for_nextday_cutoff( $return = false ) { return true; }
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.
How can I add new field/s in ‘Order Delivery Date Settings’ section in Date settings tab?
Hook:
orddd_date_settings_section
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; }
How can I add new field/s in ‘Integration with Other Plugins’ section in Date settings tab?
Hook:
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:
How can I obtain Delivery Date information for a particular order?
Hook:
orddd_get_order_delivery_date
: Use this function to
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.
How can I obtain Time slot information for a particular order?
Hook:
orddd_get_order_timeslot
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.