Add Delivery Date And Time To WooCommerce PDF Invoices & Packing Slips By WP Overnight
To add the delivery date and time from WooCommerce Delivery Slots to your invoices and packing slips generated by the “WooCommerce PDF Invoices & Packing Slips” by WP Overnight, you can use the following code.
To use the code, add it to your child theme’s functions.php file.
<?php
/**
* Add Date and Time Slots to Invoices
*/
function iconic_wpo_wcpdf_delivery_date( $template_type, $order ) {
if ( $template_type !== 'packing-slip' ) {
return;
}
$date = $order->get_meta( 'jckwds_date' );
$time_slot = $order->get_meta( 'jckwds_timeslot' );
?>
<tr class="iconic-delivery-date">
<th><?php _e( 'Order Slot:', 'iconic' ); ?></th>
<td>
<?php echo $date; ?><br>
<?php echo $time_slot; ?>
</td>
</tr>
<?php
}
add_action( 'wpo_wcpdf_after_order_data', 'iconic_wpo_wcpdf_delivery_date', 10, 2 );