Merge pull request #23004 from woocommerce/fix/legact-date-update

Check updated props for date variables
This commit is contained in:
Rodrigo Primo 2019-03-12 16:42:58 -03:00 committed by GitHub
commit 73fbed3411
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -266,12 +266,13 @@ class WC_Order_Data_Store_CPT extends Abstract_WC_Order_Data_Store_CPT implement
}
// Legacy date handling. @todo remove in 4.0.
if ( 'date_paid' === $prop ) {
if ( in_array( 'date_paid', $updated_props, true ) ) {
$value = $order->get_date_paid( 'edit' );
// In 2.6.x date_paid was stored as _paid_date in local mysql format.
update_post_meta( $id, '_paid_date', ! is_null( $value ) ? $value->date( 'Y-m-d H:i:s' ) : '' );
}
if ( 'date_completed' === $prop ) {
if ( in_array( 'date_completed', $updated_props, true ) ) {
$value = $order->get_date_completed( 'edit' );
// In 2.6.x date_paid was stored as _paid_date in local mysql format.
update_post_meta( $id, '_completed_date', ! is_null( $value ) ? $value->date( 'Y-m-d H:i:s' ) : '' );