Add order_comments
-
This PR will add order_comments (customer’s comment) to message template:
file Classes/WooCommerce.php
public function filterTemplate($replace){ $replace['{order_id}'] = $this->order_id; $replace['{order_comments}'] = $this->order->get_customer_note(); $replace['{order_status}'] = wc_get_order_status_name($this->order->get_status()); $replace['{total}'] = wc_price($this->order->get_total()); $replace['{order_date_created}'] = $this->order->get_date_created()->date(get_option('links_updated_date_format')); return $replace; }
file Classes/SettingPage.php
<div class="row"> <table class="form-table"> <tbody> <tr> <th></th> <td> <button id="nktgnfw_send_test_message" type="button" class="button-primary"><?= __('Send test message','nktgnfw')?></button></td> </tr> <tr> <th><h4><?= __('Allow tags for Telegram Message', 'nktgnfw') ?></h4></th> <td><textarea class="code wp-editor-area" rows="15" readonly><b>bold</b> <strong>bold</strong> <i>italic</i> <em>italic</em> <u>underline</u> <ins>underline</ins> <s>strikethrough</s> <strike>strikethrough</strike> <del>strikethrough</del> <a href="https://www.domain.com/">inline URL</a> <code>code</code> <pre>code block</pre></textarea></td> </tr> <tr> <th><h4><?= __('Shortcodes for Telegram Message', 'nktgnfw') ?></h4></th> <td><textarea class="code wp-editor-area" rows="15" readonly>{order_comments} {order_id} {order_date_created} {order_status} {products} {total} {billing-first_name} {billing-last_name} {billing-address_1} {billing-address_2} {billing-city} {billing-state} {billing-postcode} {billing-email} {billing-phone} {payment_method} {payment_method_title} {customer_ip_address} {customer_user_agent} </textarea></td> </tr> <tr> <th></th> <td><?= wp_kses(__("Visit <a href='https://choplugins.com' target='_blank'>our website</a> to get more useful plugins", "nktgnfw"), ['a' => ['href' => 'https://choplugins.com','target' =>'_blank']]); ?></td> </tr> </tbody> </table> </div>
- The topic ‘Add order_comments’ is closed to new replies.