New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update modified date when a metadata is saved for HPOS. #39911
Conversation
Test Results SummaryCommit SHA: 9b10f04
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
371a7bc
to
e7875ab
Compare
Additionally, move the `type` column from always change to optional, by moving it so that its applied if there is atleast one other change.
Hi @coreymckrill, Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Works as described testing with wp shell. Noting that I also tested running $order->save_meta_data()
without first adding/updating/deleting any meta data, and it did not change the date modified value, which is as expected.
|
||
// Prevent this happening multiple time in same request. | ||
if ( $order->get_date_modified() < $current_date_time && empty( $order->get_changes() ) ) { | ||
$order->set_date_modified( current_time( 'mysql' ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking that the call to current_time
here should also have the 1
gmt switch, like above, but I guess that set_date_modified
handles that already?
* Update modified date when a metadata is saved for HPOS. (#39911) * Prep for cherry pick 39911 --------- Co-authored-by: nigeljamesstevenson <105309450+nigeljamesstevenson@users.noreply.github.com> Co-authored-by: WooCommerce Bot <no-reply@woocommerce.com>
Submission Review Guidelines:
Changes proposed in this Pull Request:
When using a
$order->save_meta_data()
method, we have a gap in our sync logic that we do not update thedate_updated_gmt
column. The consequence here is that it will become non-deterministic for code to figure whether posts or order is more updated when there is a difference between them. To prevent this, we also update the modified date when updating the metadata via save_metadata.How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
Note that we will be using wp shell to test this as it's not possible in the UI only to reproduce the bug.
wp shell
and test following:Changelog entry
Significance
Type
Message
Comment