Update src/Internal/RestockRefundedItemsAdjuster.php

Co-authored-by: Vedanshu Jain <vedanshu.jain.2012@gmail.com>
This commit is contained in:
Roy Ho 2021-05-20 13:14:35 -07:00 committed by GitHub
parent 006f580b28
commit 41f44578c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -45,7 +45,10 @@ class RestockRefundedItemsAdjuster {
if ( version_compare( $order_version, '5.4', '>=' ) ) { if ( version_compare( $order_version, '5.4', '>=' ) ) {
return; return;
} }
// If there are no refund lines, then this migration isn't necessary because restock related meta's wouldn't be set.
if ( 0 === count( $order->get_refunds() ) ) {
return;
}
if ( isset( $items['order_item_id'] ) ) { if ( isset( $items['order_item_id'] ) ) {
foreach ( $items['order_item_id'] as $item_id ) { foreach ( $items['order_item_id'] as $item_id ) {
$item = $this->order_factory::get_order_item( absint( $item_id ) ); $item = $this->order_factory::get_order_item( absint( $item_id ) );