From e17fc6e2bd8a6e374196677523510d8cdbdb151f Mon Sep 17 00:00:00 2001 From: Praboda Ariyasinghe Date: Mon, 21 Jan 2019 16:03:40 +0530 Subject: [PATCH 1/3] Support customer note for shortcodes --- includes/NotifyLKTrigger.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/NotifyLKTrigger.php b/includes/NotifyLKTrigger.php index f1b4547..742c4c9 100644 --- a/includes/NotifyLKTrigger.php +++ b/includes/NotifyLKTrigger.php @@ -100,6 +100,7 @@ public static function shortCode($message, $order_details) { '{{last_name}}' => ucfirst($order_details->billing_last_name), '{{billing_city}}' => ucfirst($order_details->billing_city), '{{customer_phone}}' => $order_details->billing_phone, + '{{customer_note}}' => $order_details->customer_note ); return str_replace(array_keys($replacements_string), $replacements_string, $message); } From dd361fe271660c9454e3797b5e68657896ada813 Mon Sep 17 00:00:00 2001 From: Praboda Ariyasinghe Date: Tue, 22 Jan 2019 15:08:12 +0530 Subject: [PATCH 2/3] Fix the issue --- includes/NotifyLKTrigger.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/NotifyLKTrigger.php b/includes/NotifyLKTrigger.php index 742c4c9..36f5f1a 100644 --- a/includes/NotifyLKTrigger.php +++ b/includes/NotifyLKTrigger.php @@ -91,6 +91,7 @@ public function notify_send_customer_sms_for_woo_order_status_cancelled($order_i } public static function shortCode($message, $order_details) { + $customer_notes = $order_details->get_customer_order_notes(); $replacements_string = array( '{{shop_name}}' => get_bloginfo('name'), '{{order_id}}' => $order_details->get_order_number(), @@ -100,7 +101,7 @@ public static function shortCode($message, $order_details) { '{{last_name}}' => ucfirst($order_details->billing_last_name), '{{billing_city}}' => ucfirst($order_details->billing_city), '{{customer_phone}}' => $order_details->billing_phone, - '{{customer_note}}' => $order_details->customer_note + '{{customer_note}}' => isset($customer_notes[0]) ? $customer_notes[0]->comment_content : '' ); return str_replace(array_keys($replacements_string), $replacements_string, $message); } From dbe681eaf60e0eb151397cb96544464c4ffc5fe2 Mon Sep 17 00:00:00 2001 From: Praboda Ariyasinghe Date: Tue, 22 Jan 2019 15:09:34 +0530 Subject: [PATCH 3/3] add description --- includes/NotifyLKSMS.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/NotifyLKSMS.php b/includes/NotifyLKSMS.php index ec9fdb0..15b1762 100644 --- a/includes/NotifyLKSMS.php +++ b/includes/NotifyLKSMS.php @@ -283,7 +283,8 @@ private function getFields() { '{{order_amount}}' => "Current order amount", '{{order_status}}' => 'Current order status (Pending, Failed, Processing, etc...)', '{{billing_city}}' => 'The city in the customer billing address (If available)', - '{{customer_phone}}' => 'Customer mobile number. (If given)' + '{{customer_phone}}' => 'Customer mobile number. (If given)', + '{{customer_note}}' => 'Customer notes. (Will use the first one if multiple available)' ); $fields[] = array(