/** * Add custom order status emails to WC emails * * @since 1.0.0 * @param array $emails * @return array $emails */ public function order_status_emails($emails) { include wc_order_status_manager()->get_plugin_path() . '/includes/class-wc-order-status-manager-order-status-email.php'; foreach ($this->get_emails() as $email) { $email_id = 'wc_order_status_email_' . esc_attr($email->ID); $emails[$email_id] = new WC_Order_Status_Manager_Order_Status_Email($email_id, array('post_id' => $email->ID, 'title' => $email->post_title, 'description' => $email->post_excerpt, 'type' => get_post_meta($email->ID, '_email_type', true), 'dispatch_conditions' => get_post_meta($email->ID, '_email_dispatch_condition'))); } return $emails; }
/** * Update icon options * * Extracts icons and their glyphs from font icon stylesheets and * saves the resulting array as an option to wp_options table * * @since 1.0.0 */ public function update_icon_options() { $options = array(); // Dashicons, included in WP $options['Dashicons'] = array(); $glyphs = $this->extract_icon_glyphs(ABSPATH . WPINC . '/css/dashicons.css', 'dashicons'); foreach ($glyphs as $class => $glyph) { // prepend each icon class with the generic `dashicons` class $options['Dashicons']['dashicons ' . $class] = $glyph; } $plugin_path = wc_order_status_manager()->get_plugin_path(); // WooCommerce, included in WC, but classes need to be loaded from our plugin $options['WooCommerce'] = $this->extract_icon_glyphs($plugin_path . '/assets/css/woocommerce-font-classes.css', 'wcicon'); // FontAwesome $options['FontAwesome'] = array(); $glyphs = $this->extract_icon_glyphs($plugin_path . '/assets/css/font-awesome.css', 'fa'); foreach ($glyphs as $class => $glyph) { // prepend each icon class with the generic `fa` class $options['FontAwesome']['fa ' . $class] = $glyph; } // Update the option, specifying autoload=no delete_option('wc_order_status_manager_icon_options'); add_option('wc_order_status_manager_icon_options', $options, '', 'no'); }
/** * Check if this status is a core (manually registered) status or not * * @since 1.0.0 * @return boolean True, if this is a core status, false otherwise */ public function is_core_status() { $core_statuses = wc_order_status_manager()->order_statuses->get_core_order_statuses(); return isset($core_statuses[$this->get_slug(true)]); }
function init_woocommerce_order_status_manager() { /** * # WooCommerce Order Status Manager Main Plugin Class * * ## Plugin Overview * * This plugin allows adding custom order statuses to WooCommerce * * @since 1.0.0 */ class WC_Order_Status_Manager extends SV_WC_Plugin { /** plugin version number */ const VERSION = '1.2.2'; /** @var WC_Order_Status_Manager single instance of this plugin */ protected static $instance; /** plugin id */ const PLUGIN_ID = 'order_status_manager'; /** plugin meta prefix */ const PLUGIN_PREFIX = 'wc_order_status_manager_'; /** plugin text domain */ const TEXT_DOMAIN = 'woocommerce-order-status-manager'; /** @var \WC_Order_Status_Manager_Admin instance */ public $admin; /** @var \WC_Order_Status_Manager_Frontend instance */ public $frontend; /** @var \WC_Order_Status_Manager_AJAX instance */ public $ajax; /** @var \WC_Order_Status_Manager_Order_Statuses instance */ public $order_statuses; /** @var \WC_Order_Status_Manager_Emails instance */ public $emails; /** @var \WC_Order_Status_Manager_Icons instance */ public $icons; /** * Initializes the plugin * * @since 1.0.0 * @return \WC_Order_Status_Manager */ public function __construct() { parent::__construct(self::PLUGIN_ID, self::VERSION, self::TEXT_DOMAIN); add_action('init', array($this, 'init')); // Make sure email template files are searched for in our plugin add_filter('woocommerce_locate_template', array($this, 'locate_template'), 20, 3); add_filter('woocommerce_locate_core_template', array($this, 'locate_template'), 20, 3); } /** * Include Order Status Manager required files * * @since 1.0.0 */ public function includes() { require_once $this->get_plugin_path() . '/includes/class-wc-order-status-manager-order-statuses.php'; $this->order_statuses = new WC_Order_Status_Manager_Order_Statuses(); require_once $this->get_plugin_path() . '/includes/class-wc-order-status-manager-post-types.php'; WC_Order_Status_Manager_Post_Types::initialize(); require_once $this->get_plugin_path() . '/includes/class-wc-order-status-manager-emails.php'; require_once $this->get_plugin_path() . '/includes/class-wc-order-status-manager-icons.php'; $this->emails = new WC_Order_Status_Manager_Emails(); $this->icons = new WC_Order_Status_Manager_Icons(); // Frontend includes if (!is_admin() || defined('DOING_AJAX')) { require_once $this->get_plugin_path() . '/includes/class-wc-order-status-manager-frontend.php'; $this->frontend = new WC_Order_Status_Manager_Frontend(); } // Admin includes if (is_admin() && !defined('DOING_AJAX')) { $this->admin_includes(); } if (defined('DOING_AJAX')) { $this->ajax_includes(); } } /** * Include required admin files * * @since 1.0.0 */ private function admin_includes() { require_once $this->get_plugin_path() . '/includes/admin/class-wc-order-status-manager-admin.php'; $this->admin = new WC_Order_Status_Manager_Admin(); } /** * Include required AJAX files * * @since 1.0.0 */ private function ajax_includes() { include_once $this->get_plugin_path() . '/includes/class-wc-order-status-manager-ajax.php'; $this->ajax = new WC_Order_Status_Manager_AJAX(); } /** * Load plugin text domain. * * @since 1.0.0 * @see SV_WC_Plugin::load_translation() */ public function load_translation() { load_plugin_textdomain('woocommerce-order-status-manager', false, dirname(plugin_basename($this->get_file())) . '/i18n/languages'); } /** * Initialize translation and post types * * @since 1.0.0 */ public function init() { // Include required files $this->includes(); } /** * Locates the WooCommerce template files from our templates directory * * @since 1.0.0 * @param string $template Already found template * @param string $template_name Searchable template name * @param string $template_path Template path * @return string Search result for the template */ public function locate_template($template, $template_name, $template_path) { // Only keep looking if no custom theme template was found or if // a default WooCommerce template was found. if (!$template || SV_WC_Helper::str_starts_with($template, WC()->plugin_path())) { // Set the path to our templates directory $plugin_path = $this->get_plugin_path() . '/templates/'; // If a template is found, make it so if (is_readable($plugin_path . $template_name)) { $template = $plugin_path . $template_name; } } return $template; } /** Admin methods ******************************************************/ /** * Render a notice for the user to read the docs before using the plugin * * @since 1.0.0 * @see SV_WC_Plugin::add_admin_notices() */ public function add_admin_notices() { // show any dependency notices parent::add_admin_notices(); $this->get_admin_notice_handler()->add_admin_notice(sprintf(__('Thanks for installing Order Status Manager! Before you get started, please take a moment to %sread through the documentation%s.', $this->text_domain), '<a href="' . $this->get_documentation_url() . '">', '</a>'), 'read-the-docs', array('always_show_on_settings' => false, 'notice_class' => 'updated')); } /** Helper methods ******************************************************/ /** * Main Order Status Manager Instance, ensures only one instance is/can be loaded * * @since 1.1.0 * @see wc_order_status_manager() * @return WC_Order_Status_Manager */ public static function instance() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; } /** * Returns the plugin name, localized * * @since 1.0.0 * @see SV_WC_Plugin::get_plugin_name() * @return string the plugin name */ public function get_plugin_name() { return __('WooCommerce Order Status Manager', $this->text_domain); } /** * Returns __FILE__ * * @since 1.0.0 * @see SV_WC_Plugin::get_file() * @return string the full path and filename of the plugin file */ protected function get_file() { return __FILE__; } /** * Gets the URL to the settings page * * @since 1.0.0 * @see SV_WC_Plugin::get_settings_url() * @param string $_ unused * @return string URL to the settings page */ public function get_settings_url($_ = '') { return admin_url('edit.php?post_type=wc_order_status'); } /** * Gets the plugin documentation URL * * @since 1.2.0 * @see SV_WC_Plugin::get_documentation_url() * @return string */ public function get_documentation_url() { return 'http://docs.woothemes.com/document/woocommerce-order-status-manager/'; } /** * Gets the plugin support URL * * @since 1.2.0 * @see SV_WC_Plugin::get_support_url() * @return string */ public function get_support_url() { return 'http://support.woothemes.com/'; } /** * Returns true if on the Order Status Manager settings page * * @since 1.0.0 * @see SV_WC_Plugin::is_plugin_settings() * @return boolean true if on the settings page */ public function is_plugin_settings() { return isset($_GET['post_type']) && 'wc_order_status' == $_GET['post_type']; } /** Lifecycle methods ******************************************************/ /** * Install defaults * * @since 1.0.0 * @see SV_WC_Plugin::install() */ protected function install() { $this->icons->update_icon_options(); // create posts for all order statuses $this->order_statuses->ensure_statuses_have_posts(); } /** * Perform any version-related changes. * * @since 1.0.0 * @param int $installed_version the currently installed version of the plugin */ protected function upgrade($installed_version) { // Always update icon options $this->icons->update_icon_options(); if (version_compare($installed_version, '1.1.0', '<')) { foreach ($this->order_statuses->get_core_order_statuses() as $slug => $core_status) { $status = new WC_Order_Status_Manager_Order_Status($slug); $post_id = $status->get_id(); $slug = str_replace('wc-', '', $slug); switch ($slug) { case 'processing': update_post_meta($post_id, '_include_in_reports', 'yes'); break; case 'on-hold': update_post_meta($post_id, '_include_in_reports', 'yes'); break; case 'completed': update_post_meta($post_id, '_include_in_reports', 'yes'); break; case 'refunded': update_post_meta($post_id, '_include_in_reports', 'yes'); break; } } } } } // end \WC_Order_Status_Manager class /** * Returns the One True Instance of Order Status Manager * * @since 1.1.0 * @return WC_Order_Status_Manager */ function wc_order_status_manager() { return WC_Order_Status_Manager::instance(); } /** * The WC_Order_Status_Manager global object * * @deprecated 1.1.0 * @name $wc_order_status_manager * @global WC_Order_Status_Manager $GLOBALS['wc_order_status_manager'] */ $GLOBALS['wc_order_status_manager'] = wc_order_status_manager(); }
/** * Register custom order statuses for orders * * @since 1.0.0 */ public static function register_post_status() { foreach (wc_get_order_statuses() as $slug => $name) { // Don't register manually registered statuses if (wc_order_status_manager()->order_statuses->is_core_status($slug)) { continue; } register_post_status($slug, array('label' => $name, 'public' => false, 'exclude_from_search' => false, 'show_in_admin_all_list' => true, 'show_in_admin_status_list' => true, 'label_count' => _n_noop($name . ' <span class="count">(%s)</span>', $name . ' <span class="count">(%s)</span>', WC_Order_Status_Manager::TEXT_DOMAIN))); } }
/** * Output custom column content * * @since 1.0.0 * @param string $column * @param int $post_id */ public function custom_column_content($column, $post_id) { $status = new WC_Order_Status_Manager_Order_Status($post_id); switch ($column) { case 'icon': $color = $status->get_color(); $icon = $status->get_icon(); $style = ''; if ($color) { if ($icon) { $style = 'color: ' . $color . ';'; } else { $style = 'background-color: ' . $color . '; color: ' . wc_order_status_manager()->icons->get_contrast_text_color($color) . ';'; } } if (is_numeric($icon)) { $icon_src = wp_get_attachment_image_src($icon, 'wc_order_status_icon'); if ($icon_src) { $style .= 'background-image: url( ' . $icon_src[0] . ');'; } } printf('<mark class="%s %s tips" style="%s" data-tip="%s">%s</mark>', sanitize_title($status->get_slug()), $icon ? 'has-icon ' . $icon : '', $style, esc_attr($status->get_name()), esc_html($status->get_name())); break; case 'slug': echo esc_html($status->get_slug()); break; case 'description': echo esc_html($status->get_description()); break; case 'type': printf('<span class="badge %s">%s</span>', sanitize_title($status->get_type()), esc_html($status->get_type())); break; } }
/** * Print styles for custom order status icons * * @since 1.0.0 */ public function custom_order_status_icons() { $custom_status_colors = array(); $custom_status_badges = array(); $custom_status_icons = array(); $custom_action_icons = array(); foreach (wc_get_order_statuses() as $slug => $name) { $status = new WC_Order_Status_Manager_Order_Status($slug); // Sanity check: bail if no status was found. // This can happen if some statuses are registered late if (!$status || !$status->get_id()) { continue; } $color = $status->get_color(); $icon = $status->get_icon(); $action_icon = $status->get_action_icon(); if ($color) { $custom_status_colors[esc_attr($status->get_slug())] = $color; } // Font icon if ($icon && ($icon_details = wc_order_status_manager()->icons->get_icon_details($icon))) { $custom_status_icons[esc_attr($status->get_slug())] = $icon_details; } elseif (is_numeric($icon) && ($icon_src = wp_get_attachment_image_src($icon, 'wc_order_status_icon'))) { $custom_status_icons[esc_attr($status->get_slug())] = $icon_src[0]; } elseif (!$icon) { $custom_status_badges[] = esc_attr($status->get_slug()); } // Font action icon if ($action_icon && ($action_icon_details = wc_order_status_manager()->icons->get_icon_details($action_icon))) { $custom_action_icons[esc_attr($status->get_slug())] = $action_icon_details; } elseif (is_numeric($action_icon) && ($action_icon_src = wp_get_attachment_image_src($action_icon, 'wc_order_status_icon'))) { $custom_action_icons[esc_attr($status->get_slug())] = $action_icon_src[0]; } } ?> <!-- Custom Order Status Icon styles --> <style type="text/css"> /*<![CDATA[*/ <?php // General styles for status badges ?> <?php if (!empty($custom_status_badges)) { ?> .widefat .column-order_status mark.<?php echo implode(', .widefat .column-order_status mark.', $custom_status_badges); ?> { display: inline-block; font-size: 0.8em; line-height: 1.1; text-indent: 0; background-color: #666; width: auto; height: auto; padding: 0.4em; color: #fff; border-radius: 2px; word-wrap: break-word; max-width: 100%; } .widefat .column-order_status mark.<?php echo implode(':after, .widefat .column-order_status mark.', $custom_status_badges); ?> :after { display: none; } <?php } ?> <?php // General styles for status icons ?> <?php if (!empty($custom_status_icons)) { ?> <?php $custom_status_font_icons = array_filter($custom_status_icons, 'is_array'); ?> <?php if (!empty($custom_status_font_icons)) { ?> .widefat .column-order_status mark.<?php echo implode(':after, .widefat .column-order_status mark.', array_keys($custom_status_font_icons)); ?> :after { speak: none; font-weight: normal; font-variant: normal; text-transform: none; line-height: 1; -webkit-font-smoothing: antialiased; margin: 0; text-indent: 0; position: absolute; top: 0; left: 0; width: 100%; height: 100%; text-align: center; } <?php } ?> <?php } ?> <?php // General styles for action icons ?> .widefat .column-order_actions a.button { padding: 0 0.5em; height: 2em; line-height: 1.9em; } <?php if (!empty($custom_action_icons)) { ?> <?php $custom_action_font_icons = array_filter($custom_action_icons, 'is_array'); ?> <?php if (!empty($custom_action_font_icons)) { ?> .order_actions .<?php echo implode(', .order_actions .', array_keys($custom_action_icons)); ?> { display: block; text-indent: -9999px; position: relative; padding: 0!important; height: 2em!important; width: 2em; } .order_actions .<?php echo implode(':after, .order_actions .', array_keys($custom_action_icons)); ?> :after { speak: none; font-weight: 400; font-variant: normal; text-transform: none; -webkit-font-smoothing: antialiased; margin: 0; text-indent: 0; position: absolute; top: 0; left: 0; width: 100%; height: 100%; text-align: center; line-height: 1.85; } <?php } ?> <?php } ?> <?php // Specific status icon styles ?> <?php if (!empty($custom_status_icons)) { ?> <?php foreach ($custom_status_icons as $status => $value) { ?> <?php if (is_array($value)) { ?> .widefat .column-order_status mark.<?php echo $status; ?> :after { font-family: "<?php echo $value['font']; ?> "; content: "<?php echo $value['glyph']; ?> "; } <?php } else { ?> .widefat .column-order_status mark.<?php echo $status; ?> { background-size: 100% 100%; background-image: url( <?php echo $value; ?> ); } <?php } ?> <?php } ?> <?php } ?> <?php // Specific status color styles ?> <?php if (!empty($custom_status_colors)) { ?> <?php foreach ($custom_status_colors as $status => $color) { ?> <?php if (in_array($status, $custom_status_badges)) { ?> .widefat .column-order_status mark.<?php echo $status; ?> { background-color: <?php echo $color; ?> ; color: <?php echo wc_order_status_manager()->icons->get_contrast_text_color($color); ?> ; } <?php } ?> <?php if (isset($custom_status_icons[$status])) { ?> .widefat .column-order_status mark.<?php echo $status; ?> :after { color: <?php echo $color; ?> ; } <?php } ?> <?php } ?> <?php } ?> <?php // Specific action icon styles ?> <?php if (!empty($custom_action_icons)) { ?> <?php foreach ($custom_action_icons as $status => $value) { ?> <?php if (is_array($value)) { ?> .order_actions .<?php echo $status; ?> :after { font-family: "<?php echo $value['font']; ?> "; content: "<?php echo $value['glyph']; ?> "; } <?php } else { ?> .order_actions .<?php echo $status; ?> , .order_actions .<?php echo $status; ?> :focus, .order_actions .<?php echo $status; ?> :hover { background-size: 69% 69%; background-position: center center; background-repeat: no-repeat; background-image: url( <?php echo $value; ?> ); } <?php } ?> <?php } ?> <?php } ?> /*]]>*/ </style> <?php }
/** * Load admin js/css * * @since 1.0.0 */ public function load_styles_scripts() { // Get admin screen id $screen = get_current_screen(); // order status edit screen specific styles & scripts if ('wc_order_status' == $screen->id) { // color picker script/styles wp_enqueue_script('wp-color-picker'); wp_enqueue_style('wp-color-picker'); // jquery fonticonpicker wp_enqueue_script('jquery-fonticonpicker', wc_order_status_manager()->get_plugin_url() . '/assets/js/jquery-fonticonpicker/jquery.fonticonpicker.min.js', array('jquery'), WC_Order_Status_Manager::VERSION); wp_enqueue_style('wc-order-status-manager-jquery-fonticonpicker', wc_order_status_manager()->get_plugin_url() . '/assets/css/admin/wc-order-status-manager-jquery-fonticonpicker.min.css', null, WC_Order_Status_Manager::VERSION); wp_enqueue_media(); } if ('edit-shop_order' == $screen->id) { // Font Awesome font & classes wp_enqueue_style('font-awesome', wc_order_status_manager()->get_plugin_url() . '/assets/css/font-awesome.min.css', null, WC_Order_Status_Manager::VERSION); } // Load styles and scripts on order status screens if ($this->is_order_status_manager_screen()) { // load WC admin CSS wp_enqueue_style('woocommerce_admin_styles', WC()->plugin_url() . '/assets/css/admin.css'); // admin CSS wp_enqueue_style('wc-order-status-manager-admin', wc_order_status_manager()->get_plugin_url() . '/assets/css/admin/wc-order-status-manager-admin.min.css', array('woocommerce_admin_styles'), WC_Order_Status_Manager::VERSION); // WooCommerce font class declarations wp_enqueue_style('woocommerce-font-classes', wc_order_status_manager()->get_plugin_url() . '/assets/css/woocommerce-font-classes.min.css', array('woocommerce_admin_styles'), WC_Order_Status_Manager::VERSION); // Font Awesome font & classes wp_enqueue_style('font-awesome', wc_order_status_manager()->get_plugin_url() . '/assets/css/font-awesome.min.css', null, WC_Order_Status_Manager::VERSION); // admin JS wp_enqueue_script('wc-order-status-manager-admin', wc_order_status_manager()->get_plugin_url() . '/assets/js/admin/wc-order-status-manager-admin.min.js', array('jquery', 'jquery-tiptip', SV_WC_Plugin_Compatibility::is_wc_version_gte_2_3() ? 'select2' : 'chosen'), WC_Order_Status_Manager::VERSION); // localize admin JS $order_statuses = array(); foreach (wc_get_order_statuses() as $slug => $name) { $order_statuses[str_replace('wc-', '', $slug)] = $name; } $script_data = array('ajax_url' => admin_url('admin-ajax.php'), 'order_statuses' => $order_statuses, 'i18n' => array('remove_this_condition' => __('Remove this condition?', WC_Order_Status_Manager::TEXT_DOMAIN), 'from_status' => __('From Status', WC_Order_Status_Manager::TEXT_DOMAIN), 'to_status' => __('To Status', WC_Order_Status_Manager::TEXT_DOMAIN), 'remove' => __('Remove', WC_Order_Status_Manager::TEXT_DOMAIN), 'any' => __('Any', WC_Order_Status_Manager::TEXT_DOMAIN), 'select_icon' => __('Select Icon', WC_Order_Status_Manager::TEXT_DOMAIN), 'all_icon_packages' => __('All icon packages', WC_Order_Status_Manager::TEXT_DOMAIN), 'search_icons' => __('Search Icons', WC_Order_Status_Manager::TEXT_DOMAIN), 'choose_file' => __('Choose a file', WC_Order_Status_Manager::TEXT_DOMAIN))); if ('wc_order_status' == $screen->id) { // Create a flat list of icon classes for icon options, we // do not need the glyphs there $icon_options = array(); foreach (wc_order_status_manager()->icons->get_icon_options() as $package => $icons) { $icon_options[$package] = array_keys($icons); } $script_data['icon_options'] = $icon_options; } wp_localize_script('wc-order-status-manager-admin', 'wc_order_status_manager', $script_data); } }
/** * Handle deleting an order status * * Will assign all orders that have the to-be deleted status * a replacement status, which defaults to `wc-on-hold`. * Also removes the status form any next statuses. * * @since 1.0.0 * @param int $post_id the order status post id */ public function handle_order_status_delete($post_id) { global $wpdb; // Bail out if not an order status or not published if ('wc_order_status' !== get_post_type($post_id) || 'publish' !== get_post_status($post_id)) { return; } $order_status = new WC_Order_Status_Manager_Order_Status($post_id); if (!$order_status->get_id()) { return; } /** * Filter the replacement status when an order status is deleted * * This filter is applied just before the order status is deleted, * but after the order status meta has already been deleted. * * @since 1.0.0 * * @param string $replacement Replacement order status slug. * @param string $original Original order status slug. */ $replacement_status = apply_filters('wc_order_status_manager_deleted_status_replacement', 'on-hold', $order_status->get_slug()); $replacement_status = str_replace('wc-', '', $replacement_status); $old_status_name = $order_status->get_name(); $order_rows = $wpdb->get_results($wpdb->prepare("\n\t\t\tSELECT ID FROM {$wpdb->posts}\n\t\t\tWHERE post_type = 'shop_order' AND post_status = %s\n\t\t", $order_status->get_slug(true)), ARRAY_A); $num_updated = 0; if (!empty($order_rows)) { foreach ($order_rows as $order_row) { $order = wc_get_order($order_row['ID']); $order->update_status($replacement_status, __("Order status updated because the previous status was deleted.", WC_Order_Status_Manager::TEXT_DOMAIN)); $num_updated++; } } // If any other order statuses have specified this status // as a 'next status', remove it from there $rows = $wpdb->get_results($wpdb->prepare("\n\t\t\tSELECT pm.post_id\n\t\t\tFROM {$wpdb->postmeta} pm\n\t\t\tRIGHT JOIN {$wpdb->posts} p ON pm.post_id = p.ID\n\t\t\tWHERE post_type = 'wc_order_status'\n\t\t\tAND meta_key = '_next_statuses'\n\t\t\tAND meta_value LIKE %s\n\t\t", '%' . $wpdb->esc_like($order_status->get_slug()) . '%')); if ($rows) { foreach ($rows as $row) { $next_statuses = get_post_meta($row->post_id, '_next_statuses', true); // Remove the next status slug if (($key = array_search($order_status->get_slug(), $next_statuses)) !== false) { unset($next_statuses[$key]); } update_post_meta($row->post_id, '_next_statuses', $next_statuses); } } // Add admin notice if ($num_updated && is_admin() && !defined('DOING_AJAX')) { $new_status = new WC_Order_Status_Manager_Order_Status($replacement_status); $message = sprintf(_n('%d order that was previously %s is now %s.', '%d orders that were previously %s are now %s.', $num_updated, WC_Order_Status_Manager::TEXT_DOMAIN), $num_updated, esc_html($old_status_name), esc_html($new_status->get_name())); wc_order_status_manager()->get_message_handler()->add_message($message); } }