Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support customer note for shortcodes #8

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion includes/NotifyLKSMS.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions includes/NotifyLKTrigger.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -100,6 +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}}' => isset($customer_notes[0]) ? $customer_notes[0]->comment_content : ''
);
return str_replace(array_keys($replacements_string), $replacements_string, $message);
}
Expand Down