To display ODT data on any third party plugin or on any other template copy pest the below code and carefully replace $order_id
with your related order id or assign the related order id to this variable $order_id
.
if(get_post_meta( $order_id, 'byconsolewooodt_delivery_type', true )=='take_away'){
$order_delivery_type='Pickup';
$pickup_location=get_post_meta( $order_id, 'byconsolewooodt_pickup_location', true );
$pickup_location_get_option_array_value = get_option('byconsolewooodt_pickup_location');
if(!empty($pickup_location)){
$pickup_location_index=get_post_meta( $order_id, 'byconsolewooodt_pickup_location', true );
$pickup_location_name=$pickup_location_get_option_array_value[$pickup_location_index]['location'];
$get_option_byconsolewooodt_order_page_pickup_location_lable = get_option('byconsolewooodt_order_page_pickup_location_lable');
if(!empty($get_option_byconsolewooodt_order_page_pickup_location_lable))
{
$byconsolewooodt_order_page_pickup_location_lable = get_option('byconsolewooodt_order_page_pickup_location_lable');
}
else
{
$byconsolewooodt_order_page_pickup_location_lable = 'Pickup location';
}
$location_string='
'.__($byconsolewooodt_order_page_pickup_location_lable,'ByConsoleWooODTExtended').': ' . $pickup_location_name . '
';
}else{
$location_string=__('
No pickup loaction was selected
','ByConsoleWooODTExtended');
}
$seleted_date = get_post_meta( $order_id, 'byconsolewooodt_delivery_date', true );
if(!empty($seleted_date))
{
$user_date = get_post_meta( $order_id, 'byconsolewooodt_delivery_date', true );
$productdeliverydate = $user_date;
}
else
{
$productdeliverydate = get_post_meta( $order_id, 'byconsolewooodt_delivery_date', true );
}
$formattedproductdeliverydate = get_option('byconsolewooodt_wooodt_date_formate_setting');
$delivery_time_val = get_post_meta( $order_id, 'byconsolewooodt_delivery_time', true );
if($delivery_time_val == 'as_early_as_possible')
{
$delivery_time_val_content = get_option('byconsolewooodt_as_early_as_possible_lable_text');
}
else
{
$delivery_time_val_content = get_post_meta( $order_id, 'byconsolewooodt_delivery_time', true );
}
$get_option_byconsolewooodt_order_page_pickup_date_lable = get_option('byconsolewooodt_order_page_pickup_date_lable');
if(!empty($get_option_byconsolewooodt_order_page_pickup_date_lable))
{
$byconsolewooodt_order_page_pickup_date_lable = get_option('byconsolewooodt_order_page_pickup_date_lable');
}
else
{
$byconsolewooodt_order_page_pickup_date_lable = 'Pickup date';
}
if(!empty($productdeliverydate))
{
$delivery_pickup_date = '
'.__($byconsolewooodt_order_page_pickup_date_lable,'ByConsoleWooODTExtended').': ' . date($formattedproductdeliverydate, strtotime($productdeliverydate)) . '
';
}
else
{
$delivery_pickup_date = '
'.__($byconsolewooodt_order_page_pickup_date_lable,'ByConsoleWooODTExtended').': ' . $productdeliverydate . '
';
}
$get_option_byconsolewooodt_order_page_pickup_time_lable = get_option('byconsolewooodt_order_page_pickup_time_lable');
if(!empty($get_option_byconsolewooodt_order_page_pickup_time_lable))
{
$byconsolewooodt_order_page_pickup_time_lable = get_option('byconsolewooodt_order_page_pickup_time_lable');
}
else
{
$byconsolewooodt_order_page_pickup_time_lable = 'Pickup time';
}
$byc_date_formate = get_option('byconsolewooodt_hours_format');
$full_date_string_strpos = strpos($delivery_time_val_content, " - ");
if($full_date_string_strpos != '')
{
$full_date_string_explode_val = explode(" - ",$delivery_time_val_content);
$first_time = date($byc_date_formate,strtotime($full_date_string_explode_val[0]));
$second_time = date($byc_date_formate,strtotime($full_date_string_explode_val[1]));
$delivery_time_val_content = $first_time.' - '.$second_time;
}
else
{
$delivery_time_val_content = date($byc_date_formate, strtotime($delivery_time_val_content));
}
$delivery_pickup_time = '
'.__($byconsolewooodt_order_page_pickup_time_lable,'ByConsoleWooODTExtended').': ' . $delivery_time_val_content . '
';
}
if(get_post_meta( $order_id, 'byconsolewooodt_delivery_type', true )=='levering'){
$order_delivery_type='Delivery';
$delivery_location=get_post_meta( $order_id, 'byconsolewooodt_delivery_location', true );
$delivery_location_get_option_array_value = get_option('byconsolewooodt_delivery_location');
if(!empty($delivery_location)){
$delivery_location_index=get_post_meta( $order_id, 'byconsolewooodt_delivery_location', true );
$delivery_location_name=$delivery_location_get_option_array_value[$delivery_location_index]['location'];
$get_option_byconsolewooodt_order_page_delivery_location_lable = get_option('byconsolewooodt_order_page_delivery_location_lable');
if(!empty($get_option_byconsolewooodt_order_page_delivery_location_lable))
{
$byconsolewooodt_order_page_delivery_location_lable = get_option('byconsolewooodt_order_page_delivery_location_lable');
}
else
{
$byconsolewooodt_order_page_delivery_location_lable = 'Delivery location';
}
$location_string='
'.__($byconsolewooodt_order_page_delivery_location_lable,'ByConsoleWooODTExtended').': ' . $delivery_location_name . '
';
}else{
$location_string=__('
No delivery loaction was selected
','ByConsoleWooODTExtended');
}
$seleted_date = get_post_meta( $order_id, 'byconsolewooodt_delivery_date', true );
if(!empty($seleted_date))
{
$user_date = get_post_meta( $order_id, 'byconsolewooodt_delivery_date', true );
$productdeliverydate = $user_date;
}
else
{
$productdeliverydate = get_post_meta( $order_id, 'byconsolewooodt_delivery_date', true );
}
$formattedproductdeliverydate = get_option('byconsolewooodt_wooodt_date_formate_setting');
$delivery_time_val = get_post_meta( $order_id, 'byconsolewooodt_delivery_time', true );
if($delivery_time_val == 'as_early_as_possible')
{
$delivery_time_val_content = get_option('byconsolewooodt_as_early_as_possible_lable_text');
}
else
{
$delivery_time_val_content = get_post_meta( $order_id, 'byconsolewooodt_delivery_time', true );
}
$get_option_byconsolewooodt_order_page_delivery_date_lable = get_option('byconsolewooodt_order_page_delivery_date_lable');
if(!empty($get_option_byconsolewooodt_order_page_delivery_date_lable))
{
$byconsolewooodt_order_page_delivery_date_lable = get_option('byconsolewooodt_order_page_delivery_date_lable');
}
else
{
$byconsolewooodt_order_page_delivery_date_lable = 'Delivery date';
}
if(!empty($productdeliverydate))
{
$delivery_pickup_date = '
'.__($byconsolewooodt_order_page_delivery_date_lable,'ByConsoleWooODTExtended').': ' . date($formattedproductdeliverydate, strtotime($productdeliverydate)) . '
';
}
else
{
$delivery_pickup_date = '
'.__($byconsolewooodt_order_page_delivery_date_lable,'ByConsoleWooODTExtended').': ' .$productdeliverydate. '
';
}
$get_option_byconsolewooodt_order_page_delivery_time_lable = get_option('byconsolewooodt_order_page_delivery_time_lable');
if(!empty($get_option_byconsolewooodt_order_page_delivery_time_lable))
{
$byconsolewooodt_order_page_delivery_time_lable = get_option('byconsolewooodt_order_page_delivery_time_lable');
}
else
{
$byconsolewooodt_order_page_delivery_time_lable = 'Delivery time';
}
$byc_date_formate = get_option('byconsolewooodt_hours_format');
$full_date_string_strpos = strpos($delivery_time_val_content, " - ");
if($full_date_string_strpos != '')
{
$full_date_string_explode_val = explode(" - ",$delivery_time_val_content);
$first_time = date($byc_date_formate,strtotime($full_date_string_explode_val[0]));
$second_time = date($byc_date_formate,strtotime($full_date_string_explode_val[1]));
$delivery_time_val_content = $first_time.' - '.$second_time;
}
else
{
$delivery_time_val_content = date($byc_date_formate, strtotime($delivery_time_val_content));
}
$delivery_pickup_time = '
'.__($byconsolewooodt_order_page_delivery_time_lable,'ByConsoleWooODTExtended').': ' . $delivery_time_val_content . '
';
}
$get_option_byconsolewooodt_order_page_order_type_lable = get_option('byconsolewooodt_order_page_order_type_lable');
if(!empty($get_option_byconsolewooodt_order_page_order_type_lable))
{
$byconsolewooodt_order_page_order_type_lable = get_option('byconsolewooodt_order_page_order_type_lable');
}
else
{
$byconsolewooodt_order_page_order_type_lable = 'Order Type';
}
echo '
'.__($byconsolewooodt_order_page_order_type_lable,'ByConsoleWooODTExtended').': ' . $order_delivery_type . '
';
if($productdeliverydate!='' && $delivery_time_val_content!='' )
{
echo $location_string;
echo $delivery_pickup_date;
echo $delivery_pickup_time;
}
NB: DON’T CORRECT SPELLINGS
If you need more help feel free the same at support@byconsole.com.
6 comments on “Show WooODT data on third party plugin or any other template”
Luis M
July 9, 2018 at 7:30 amwhere do we copy/paste?
ByConsole
July 9, 2018 at 1:18 pmCopy paste it on any page template where a single order is rendering or looping through orders. Like if you have any other plugin or a custom page template where it show a particular order data or a list of orders. Keep in mind variable $order_id is the order ID of the order that you wanna show. So just assign the order id variable from your existing code to this variable $order_id just before the code to pest.
newleafnutritionconsulting
January 23, 2019 at 3:58 pmHow would we use this code to add delivery / pickup info to a PDF invoice / packing slip? Previously you had a tutorial which provided an option but has since disappeared off the site.
ByConsole
January 23, 2019 at 4:16 pmYou can use this Another PDF Invoice plugin for printing date time location data on invoice.
Or
you can copy/paste it inside the existing pdf plugin file and then at top of this code just assign a variable for “$order_id”, that should be the same variable used by the current pdf plugin to indicate an order ID/number.
Or
Just request support on third party plugin/theme integration by sending an email to support@byconsole.com mentioning your order number in subject line.
ballsmkscoutsorg
August 24, 2020 at 11:46 pmHow do I slot this into an email template please?
M Dalabar
September 3, 2020 at 1:32 pmIt automatically get included in your emails( both admin and customer emails), If you are using any custom email template just make sure WC varriables are there and it will be there as well. If you still face any difficulty please contact support@byconsole.com .