Conversation
Testing GuidelinesHi @jorgeatorres @albarin , Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed. Reminder: PR reviewers are required to document testing performed. This includes:
|
|
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughWalkthroughPerformance-focused changes that reduce repeated data loads during order processing: cache line items and data stores before loops, pre-prime legacy shipping option caches, add guards around order existence, add a changelog entry, and add a unit test for usermeta purging. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Test using WordPress PlaygroundThe changes in this pull request can be previewed and tested using a WordPress Playground instance. Test this pull request with WordPress Playground. Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@plugins/woocommerce/includes/wc-order-functions.php`:
- Around line 512-521: The backward-compatibility check using
array_key_exists(OrderStatus::CHECKOUT_DRAFT, wc_get_order_statuses()) fails
because wc_get_order_statuses() returns prefixed keys (e.g.
'wc-checkout-draft'), and OrderInternalStatus::CHECKOUT_DRAFT does not exist;
fix by checking for the prefixed key string instead (e.g. 'wc-checkout-draft')
or adjust the guard to transform OrderStatus::CHECKOUT_DRAFT into the prefixed
form before calling wc_get_order_statuses(); update the conditional that sets
$purge_usermeta (and any references to OrderStatus::CHECKOUT_DRAFT) to use the
correct prefixed key or mapping logic so the backward-compatibility escape hatch
works as intended.
jorgeatorres
left a comment
There was a problem hiding this comment.
LGTM. Thank you @kalessil!
…rsist a draft order during checkout (#63258) Optimize purging customers' usermeta in `wc_downloadable_product_permissions`, which is called multiple times during order save. The optimization leverages reads as guard conditions, as reads are performed from the in-memory cache until deletions are necessary. Previously unguarded deletions were causing cache invalidation and re-read from DB.
Submission Review Guidelines:
Changes proposed in this Pull Request:
Re-iterate on #63118 (#63110, WOOPLUG-6243)
Further reduce the number of SQLs when persisting an order (check-out page in focus).
With HPOS compatibility mode
Without HPOS compatibility mode
Refresher from #63118: the eliminated SQLs are fast individually (so locally it's a micro-optimization), but the reduction in number allows us to stretch DB capacity further, when it's under pressure, SQLs are getting queued, and we have different execution timings.
Technical aspects of the changes:
get_items: fires a filter and a data store reads, a bit heavy - performed audit and applied micro-optimization (housekeeping during the exploration phase)\WC_Shipping::get_shipping_method_class_nameswc_delete_shop_order_transients(for checkout draft orders)How to test the changes in this Pull Request:
Functional testing:
Numbers verification: