Skip to content

Commit

Permalink
Improve readability around ‘woocommerce_orders_table_datastore_should…
Browse files Browse the repository at this point in the history
…_save_after_meta_change’ filter
  • Loading branch information
jorgeatorres committed Mar 13, 2024
1 parent e3222ac commit 70a77f2
Showing 1 changed file with 5 additions and 4 deletions.
Expand Up @@ -3059,17 +3059,18 @@ private function should_save_after_meta_change( $order, $meta = null ) {
$current_time = $this->legacy_proxy->call_function( 'current_time', 'mysql', 1 );
$current_date_time = new \WC_DateTime( $current_time, new \DateTimeZone( 'GMT' ) );

$should_save =
$order->get_date_modified() < $current_date_time && empty( $order->get_changes() )
&& ( ! is_object( $meta ) || ! in_array( $meta->key, $this->ephemeral_meta_keys, true ) );

/**
* Allows code to skip a full order save() when metadata is changed.
*
* @since 8.8.0
*
* @param bool $should_save Whether to trigger a full save after metadata is changed.
*/
return apply_filters(
'woocommerce_orders_table_datastore_should_save_after_meta_change',
$order->get_date_modified() < $current_date_time && empty( $order->get_changes() ) && ( ! is_object( $meta ) || ! in_array( $meta->key, $this->ephemeral_meta_keys, true ) )
);
return apply_filters( 'woocommerce_orders_table_datastore_should_save_after_meta_change', $should_save );
}

}

0 comments on commit 70a77f2

Please sign in to comment.