Table of Contents
Use the following code to add the Delivery/Pickup date and time on your prints. This code only works if you have the Delivery & Pickup Scheduling plugin enabled.
function sl_cc_printus_extra_template_data($extra, $order, $template_name){
$order_type = $order->get_meta('lpac_dps_order_type');
$order_type_text = ucfirst($order_type);
$order_date = $order->get_meta("lpac_dps_{$order_type}_date");
$order_date = date('jS F Y', strtotime($order_date));
$order_time = $order->get_meta("lpac_dps_{$order_type}_time");
$markup = "
<div style='width: 100%; margin: 0 auto; display: block'>
<p>{$order_type_text} Date: {$order_date}</p>
<p>{$order_type_text} Time: {$order_time}</p>
</div>
";
return $extra . $markup;
}
add_filter('printus_template__extra_data', 'sl_cc_printus_extra_template_data', 10, 3);
Localize the “Delivery” and “Pickup” text: #
function sl_cc_printus_extra_template_data($extra, $order, $template_name){
$order_type = $order->get_meta('lpac_dps_order_type');
// Replace DELIVERY_TRANSLATION with your localized text for "Delivery" and PICKUP_TRANSLATION with your localized text for "Pickup".
$order_type_text = ($order_type === 'delivery') ? 'DELIVERY_TRANSLATION' : 'PICKUP_TRANSLATION';
$order_date = $order->get_meta("lpac_dps_{$order_type}_date");
$order_date = date('jS F Y', strtotime($order_date));
$order_time = $order->get_meta("lpac_dps_{$order_type}_time");
$markup = "
<div style='width: 100%; margin: 0 auto; display: block'>
<p>{$order_type_text} Date: {$order_date}</p>
<p>{$order_type_text} Time: {$order_time}</p>
</div>
";
return $extra . $markup;
}
add_filter('printus_template__extra_data', 'sl_cc_printus_extra_template_data', 10, 3);
The printus_template__extra_data
filter can be used to add other custom data to the prints.