I'm adding programmatically a product custom field (the estimated delivery date) as custom cart item data if the product is ordered from backorder.
I want to display that information also on order items so it will be displayed on orders and email notifications sent to customer.
Here's what i tried so far :
add_filter( 'woocommerce_get_item_data', 'display_acf_on_cart_and_checkout', 10, 2 );
function display_acf_on_cart_and_checkout( $cart_data, $cart_item ) {
if ( ($cart_item['variation_id'] > 0 && $cart_item['data']->get_stock_quantity() <= 0
&& $cart_item['data']->get_meta('_ab_preorder_checkbox') === 'yes') || isset( $cart_item['is_preorder_field'] ) ) {
if ( $estimated_delivery_date = $cart_item['data']->get_meta('_ab_preorder_estimated_date') ) {
$custom_items[] = array( "name" => __("Date de livraison estimée (précommande) ", "woocommerce"), "value" => $estimated_delivery_date );
}
}
return $custom_items;
}
The message is showing on the cart and on the checkout page :
But not on the invoice/emails sent to the client :
I would like it to show up on like on the screenshot below (in the red rectangle). Is it possible?
Any help is appreciated.