When updating order status, ensure its a valid WC order status.
Fixes #6285
This commit is contained in:
parent
1b68406202
commit
493285f101
|
@ -2062,11 +2062,16 @@ abstract class WC_Abstract_Order {
|
|||
*/
|
||||
public function update_status( $new_status, $note = '' ) {
|
||||
|
||||
$old_status = $this->get_status();
|
||||
$new_status = 'wc-' === substr( $new_status, 0, 3 ) ? substr( $new_status, 3 ) : $new_status;
|
||||
if ( ! $this->id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Only update if they differ
|
||||
if ( $this->id && $new_status !== $old_status ) {
|
||||
// Standardise status names.
|
||||
$new_status = 'wc-' === substr( $new_status, 0, 3 ) ? substr( $new_status, 3 ) : $new_status;
|
||||
$old_status = $this->get_status();
|
||||
|
||||
// Only update if they differ - and ensure post_status is a 'wc' status.
|
||||
if ( $new_status !== $old_status || ! in_array( $this->post_status, array_keys( wc_get_order_statuses() ) ) ) {
|
||||
|
||||
// Update the order
|
||||
wp_update_post( array( 'ID' => $this->id, 'post_status' => 'wc-' . $new_status ) );
|
||||
|
|
|
@ -134,6 +134,9 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
|||
* Fix - Prevent errors when adding 'zero-rated' tax on checkout.
|
||||
* Fix - Fixed a varation product width inheritance bug.
|
||||
* Tweak - Improved headers sent notice to include file and line.
|
||||
* Tweak - When updating order status, ensure its a valid WC order status.
|
||||
* Dev - Allow getting rating count for a specific rating value #6284.
|
||||
* Localisation - Nepal States.
|
||||
|
||||
= 2.2.3 - 16/09/2014 =
|
||||
* Fix - Order status translation in admin and account page.
|
||||
|
|
Loading…
Reference in New Issue