Change action order to be compat with 2.6

Closes #12606
This commit is contained in:
Mike Jolley 2016-12-15 13:08:25 +00:00
parent c92d9d4a49
commit 3c06dab0e8
1 changed files with 2 additions and 2 deletions

View File

@ -284,6 +284,8 @@ class WC_Order extends WC_Abstract_Order {
*/
protected function status_transition() {
if ( $this->status_transition ) {
do_action( 'woocommerce_order_status_' . $this->status_transition['to'], $this->get_id() );
if ( ! empty( $this->status_transition['from'] ) ) {
/* translators: 1: old order status 2: new order status */
$transition_note = sprintf( __( 'Order status changed from %1$s to %2$s.', 'woocommerce' ), wc_get_order_status_name( $this->status_transition['from'] ), wc_get_order_status_name( $this->status_transition['to'] ) );
@ -295,8 +297,6 @@ class WC_Order extends WC_Abstract_Order {
$transition_note = sprintf( __( 'Order status set to %s.', 'woocommerce' ), wc_get_order_status_name( $this->status_transition['to'] ) );
}
do_action( 'woocommerce_order_status_' . $this->status_transition['to'], $this->get_id() );
// Note the transition occured
$this->add_order_note( trim( $this->status_transition['note'] . ' ' . $transition_note ), 0, $this->status_transition['manual'] );