Trashing/untrashing orders and updating CPT datastore-level props should not trigger update hook

This commit is contained in:
Jorge Torres 2023-08-11 14:57:34 -03:00
parent 26043fa0ea
commit d44e882f5d
1 changed files with 6 additions and 0 deletions

View File

@ -2381,6 +2381,12 @@ FROM $order_meta_table
return; return;
} }
// For backwards compat with CPT, trashing/untrashing and changing previously datastore-level props does not trigger the update hook.
if ( ( ! empty( $changes['status'] ) && in_array( 'trash', array( $changes['status'], $previous_status ), true ) )
|| ! array_diff_key( $changes, array_flip( $this->get_post_data_store_for_backfill()->get_internal_data_store_key_getters() ) ) ) {
return;
}
do_action( 'woocommerce_update_order', $order->get_id(), $order ); // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment do_action( 'woocommerce_update_order', $order->get_id(), $order ); // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
} }