Add Delivery Date And Time To Print Invoice & Delivery Notes For WooCommerce By Tyche Softwares
To add the delivery date and time from WooCommere Delivery Slots to your invoices, delivery notes, and receipts generated by the “Print Invoice & Delivery Notes for WooCommerce” by Tyche Softwares, you can use the following code.
To use the code, add it to your child theme’s functions.php file.
/**
* Add delivery date and time to Print Invoice & Delivery Notes for WooCommerce by Tyche Softwares.
*
* @param array $fields
* @param WC_Order $order
*
* @return array
*/
function iconic_add_invoice_fields( $fields, $order ) {
$delivery_date = $order->get_meta( '_jckwds_date' );
$delivery_time = $order->get_meta( '_jckwds_timeslot' );
if ( $delivery_date ) {
$fields['iconic_wds_delivery_date'] = array(
'label' => __( 'Delivery Date', 'iconic' ),
'value' => $delivery_date,
);
}
if ( $delivery_time ) {
$fields['iconic_wds_delivery_time'] = array(
'label' => __( 'Delivery Time', 'iconic' ),
'value' => $delivery_time,
);
}
return $fields;
}
add_filter( 'wcdn_order_info_fields', 'iconic_add_invoice_fields', 10, 2 );