Add customer note when the order meta is updated
-
Is it possible to add note to customer after change order meta. I use this code and it works with
add_order_note()
, but not withset_customer_note()
.add_action( 'woocommerce_process_shop_order_meta', 'save_extra_details', 10, 3 ); function save_extra_details( $post_id, $post ) { $meta_delivery_date = get_post_meta( $post_id, '_delivery_date', true ); if ( $_POST[ '_delivery_date' ] != $meta_delivery_date ) { $order = wc_get_order( $post_id ); $note = 'Delivery date was changed from ' . date("m/d/Y", strtotime($meta_delivery_date)) . ' to ' . date("m/d/Y", strtotime($_POST[ '_delivery_date' ])); //$order->add_order_note( $note ); $order->set_customer_note($note); $order->save(); ); } update_post_meta( $post_id, '_delivery_date', wc_clean( $_POST[ '_delivery_date' ] ) ); }
Is there any way to inform customer about order meta changes? Thanks
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Add customer note when the order meta is updated’ is closed to new replies.