Skip to content

Commit

Permalink
Merge pull request #1656 from xwp/fix/1655-fatal-error-on-attempt-to-…
Browse files Browse the repository at this point in the history
…empty-the-trash-for-the-woocommerce-orders

Use WC_Order_Factory  to get order id
  • Loading branch information
marcinkrzeminski authored Dec 23, 2024
2 parents f458009 + 26bc5c9 commit 7ffd0b2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions connectors/class-connector-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ public function callback_transition_post_status( $new_status, $old_status, $post
$action = 'updated';
}

$order = new \WC_Order( $post->ID );
$order_title = esc_html__( 'Order number', 'stream' ) . ' ' . esc_html( $order->get_order_number() );
$order_id = \WC_Order_Factory::get_order_id( $post->ID );
$order_title = esc_html__( 'Order number', 'stream' ) . ' ' . esc_html( $order_id );
$order_type_name = esc_html__( 'order', 'stream' );

$this->log(
Expand Down Expand Up @@ -437,8 +437,8 @@ public function callback_deleted_post( $post_id ) {
return;
}

$order = new \WC_Order( $post->ID );
$order_title = esc_html__( 'Order number', 'stream' ) . ' ' . esc_html( $order->get_order_number() );
$order_id = \WC_Order_Factory::get_order_id( $post->ID );
$order_title = esc_html__( 'Order number', 'stream' ) . ' ' . esc_html( $order_id );
$order_type_name = esc_html__( 'order', 'stream' );

$this->log(
Expand Down Expand Up @@ -495,8 +495,8 @@ public function callback_woocommerce_order_status_changed( $order_id, $old_order
'stream'
);

$order = new \WC_Order( $order_id );
$order_title = esc_html__( 'Order number', 'stream' ) . ' ' . esc_html( $order->get_order_number() );
$order_id = \WC_Order_Factory::get_order( $order_id );
$order_title = esc_html__( 'Order number', 'stream' ) . ' ' . esc_html( $order_id );
$order_type_name = esc_html__( 'order', 'stream' );

$this->log(
Expand Down

0 comments on commit 7ffd0b2

Please sign in to comment.