diff --git a/includes/class-wc-order.php b/includes/class-wc-order.php
index ebc04ef8c88..96faf3b27b9 100644
--- a/includes/class-wc-order.php
+++ b/includes/class-wc-order.php
@@ -105,11 +105,7 @@ class WC_Order {
} elseif ( 'user_id' === $key ) {
$value = ( $value = get_post_meta( $this->id, '_customer_user', true ) ) ? absint( $value ) : '';
} elseif ( 'status' === $key ) {
-
-
-
-
-
+ $value = $this->get_status();
} else {
$value = get_post_meta( $this->id, '_' . $key, true );
}
@@ -117,11 +113,11 @@ class WC_Order {
}
/**
- * Return the order statuses
+ * Return the order statuses without wc- internal prefix
* @return string
*/
public function get_status() {
- return $this->post_status;
+ return apply_filters( 'woocommerce_order_get_status', 'wc-' === substr( $this->post_status, 0, 3 ) ? substr( $this->post_status, 3 ) : $this->post_status, $this );
}
/**
@@ -132,7 +128,7 @@ class WC_Order {
* @return bool
*/
public function has_status( $status ) {
- return apply_filters( 'woocommerce_order_has_status', ( $this->post_status === $status || ( is_array( $status ) && in_array( $this->post_status, $status ) ) ) ? true : false, $this, $status );
+ return apply_filters( 'woocommerce_order_has_status', ( is_array( $status ) && in_array( $this->get_status(), $status ) ) || $this->get_status() === $status ? true : false, $this, $status );
}
/**
diff --git a/includes/class-wc-post-types.php b/includes/class-wc-post-types.php
index 40af5e671d1..faa8d82745a 100644
--- a/includes/class-wc-post-types.php
+++ b/includes/class-wc-post-types.php
@@ -348,7 +348,7 @@ class WC_Post_types {
* Register our custom post statuses, used for order status
*/
public static function register_post_status() {
- register_post_status( 'pending', array(
+ register_post_status( 'wc-pending', array(
'label' => _x( 'Pending payment', 'Order status', 'woocommerce' ),
'public' => true,
'exclude_from_search' => false,
@@ -356,7 +356,7 @@ class WC_Post_types {
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Pending payment (%s)', 'Pending payment (%s)', 'woocommerce' )
) );
- register_post_status( 'processing', array(
+ register_post_status( 'wc-processing', array(
'label' => _x( 'Processing', 'Order status', 'woocommerce' ),
'public' => true,
'exclude_from_search' => false,
@@ -364,7 +364,7 @@ class WC_Post_types {
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Processing (%s)', 'Processing (%s)', 'woocommerce' )
) );
- register_post_status( 'on-hold', array(
+ register_post_status( 'wc-on-hold', array(
'label' => _x( 'On hold', 'Order status', 'woocommerce' ),
'public' => true,
'exclude_from_search' => false,
@@ -372,7 +372,7 @@ class WC_Post_types {
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'On hold (%s)', 'On hold (%s)', 'woocommerce' )
) );
- register_post_status( 'completed', array(
+ register_post_status( 'wc-completed', array(
'label' => _x( 'Completed', 'Order status', 'woocommerce' ),
'public' => true,
'exclude_from_search' => false,
@@ -380,7 +380,7 @@ class WC_Post_types {
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Completed (%s)', 'Completed (%s)', 'woocommerce' )
) );
- register_post_status( 'cancelled', array(
+ register_post_status( 'wc-cancelled', array(
'label' => _x( 'Cancelled', 'Order status', 'woocommerce' ),
'public' => true,
'exclude_from_search' => false,
@@ -388,7 +388,7 @@ class WC_Post_types {
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Cancelled (%s)', 'Cancelled (%s)', 'woocommerce' )
) );
- register_post_status( 'refunded', array(
+ register_post_status( 'wc-refunded', array(
'label' => _x( 'Refunded', 'Order status', 'woocommerce' ),
'public' => true,
'exclude_from_search' => false,
@@ -396,7 +396,7 @@ class WC_Post_types {
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Refunded (%s)', 'Refunded (%s)', 'woocommerce' )
) );
- register_post_status( 'failed', array(
+ register_post_status( 'wc-failed', array(
'label' => _x( 'Failed', 'Order status', 'woocommerce' ),
'public' => true,
'exclude_from_search' => false,
diff --git a/includes/updates/woocommerce-update-2.2.php b/includes/updates/woocommerce-update-2.2.php
index 489c595a6e5..42993355fea 100644
--- a/includes/updates/woocommerce-update-2.2.php
+++ b/includes/updates/woocommerce-update-2.2.php
@@ -22,14 +22,14 @@ if ( get_option( 'woocommerce_ship_to_billing_address_only' ) === 'yes' ) {
}
add_option( 'woocommerce_ship_to_destination', $woocommerce_ship_to_destination, '', 'no' );
-$wpdb->show_errors();
+
// Update order statuses
$wpdb->query( "
UPDATE {$wpdb->posts} as posts
LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_ID
LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id )
LEFT JOIN {$wpdb->terms} AS term USING( term_id )
- SET posts.post_status = 'pending'
+ SET posts.post_status = 'wc-pending'
WHERE posts.post_type = 'shop_order'
AND posts.post_status = 'publish'
AND tax.taxonomy = 'shop_order_status'
@@ -41,7 +41,7 @@ $wpdb->query( "
LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_ID
LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id )
LEFT JOIN {$wpdb->terms} AS term USING( term_id )
- SET posts.post_status = 'processing'
+ SET posts.post_status = 'wc-processing'
WHERE posts.post_type = 'shop_order'
AND posts.post_status = 'publish'
AND tax.taxonomy = 'shop_order_status'
@@ -53,7 +53,7 @@ $wpdb->query( "
LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_ID
LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id )
LEFT JOIN {$wpdb->terms} AS term USING( term_id )
- SET posts.post_status = 'on-hold'
+ SET posts.post_status = 'wc-on-hold'
WHERE posts.post_type = 'shop_order'
AND posts.post_status = 'publish'
AND tax.taxonomy = 'shop_order_status'
@@ -65,7 +65,7 @@ $wpdb->query( "
LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_ID
LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id )
LEFT JOIN {$wpdb->terms} AS term USING( term_id )
- SET posts.post_status = 'completed'
+ SET posts.post_status = 'wc-completed'
WHERE posts.post_type = 'shop_order'
AND posts.post_status = 'publish'
AND tax.taxonomy = 'shop_order_status'
@@ -77,7 +77,7 @@ $wpdb->query( "
LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_ID
LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id )
LEFT JOIN {$wpdb->terms} AS term USING( term_id )
- SET posts.post_status = 'cancelled'
+ SET posts.post_status = 'wc-cancelled'
WHERE posts.post_type = 'shop_order'
AND posts.post_status = 'publish'
AND tax.taxonomy = 'shop_order_status'
@@ -89,7 +89,7 @@ $wpdb->query( "
LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_ID
LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id )
LEFT JOIN {$wpdb->terms} AS term USING( term_id )
- SET posts.post_status = 'refunded'
+ SET posts.post_status = 'wc-refunded'
WHERE posts.post_type = 'shop_order'
AND posts.post_status = 'publish'
AND tax.taxonomy = 'shop_order_status'
@@ -101,7 +101,7 @@ $wpdb->query( "
LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_ID
LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id )
LEFT JOIN {$wpdb->terms} AS term USING( term_id )
- SET posts.post_status = 'failed'
+ SET posts.post_status = 'wc-failed'
WHERE posts.post_type = 'shop_order'
AND posts.post_status = 'publish'
AND tax.taxonomy = 'shop_order_status'
diff --git a/includes/wc-order-functions.php b/includes/wc-order-functions.php
index 7a55b678c9a..f3bd1be19b1 100644
--- a/includes/wc-order-functions.php
+++ b/includes/wc-order-functions.php
@@ -20,13 +20,13 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
*/
function wc_get_order_statuses() {
$order_statuses = array(
- 'pending' => _x( 'Pending payment', 'Order status', 'woocommerce' ),
- 'processing' => _x( 'Processing', 'Order status', 'woocommerce' ),
- 'on-hold' => _x( 'On hold', 'Order status', 'woocommerce' ),
- 'completed' => _x( 'Completed', 'Order status', 'woocommerce' ),
- 'cancelled' => _x( 'Cancelled', 'Order status', 'woocommerce' ),
- 'refunded' => _x( 'Refunded', 'Order status', 'woocommerce' ),
- 'failed' => _x( 'Failed', 'Order status', 'woocommerce' ),
+ 'wc-pending' => _x( 'Pending payment', 'Order status', 'woocommerce' ),
+ 'wc-processing' => _x( 'Processing', 'Order status', 'woocommerce' ),
+ 'wc-on-hold' => _x( 'On hold', 'Order status', 'woocommerce' ),
+ 'wc-completed' => _x( 'Completed', 'Order status', 'woocommerce' ),
+ 'wc-cancelled' => _x( 'Cancelled', 'Order status', 'woocommerce' ),
+ 'wc-refunded' => _x( 'Refunded', 'Order status', 'woocommerce' ),
+ 'wc-failed' => _x( 'Failed', 'Order status', 'woocommerce' ),
);
return apply_filters( 'wc_order_statuses', $order_statuses );