Example #1
0
 /**
  * Mark an order with a status
  */
 public static function mark_order_status()
 {
     if (current_user_can('edit_shop_orders') && check_admin_referer('woocommerce-mark-order-status')) {
         $status = sanitize_text_field($_GET['status']);
         $order_id = absint($_GET['order_id']);
         if (wc_is_order_status('wc-' . $status) && $order_id) {
             $order = wc_get_order($order_id);
             $order->update_status($status);
             do_action('woocommerce_order_edit_status', $order_id, $status);
         }
     }
     wp_safe_redirect(wp_get_referer() ? wp_get_referer() : admin_url('edit.php?post_type=shop_order'));
     die;
 }
Example #2
0
 /**
  * Test wc_is_order_status().
  *
  * @since 2.3.0
  */
 public function test_wc_is_order_status()
 {
     $this->assertEquals(true, wc_is_order_status('wc-pending'));
     $this->assertEquals(false, wc_is_order_status('wc-another-status'));
 }