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:42 -07:00 committed by GitHub
parent 41f44578c7
commit 20a73762c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -60,7 +60,10 @@ class RestockRefundedItemsAdjuster {
if ( 'line_item' !== $item->get_type() ) {
continue;
}
// there could be code paths in custom code which don't update version number but still update the items.
if ( '' !== $item->get_meta( '_restock_refunded_items', true ) ) {
continue;
}
$refunded_item_quantity = abs( $order->get_qty_refunded_for_item( $item->get_id() ) );
$item->add_meta_data( '_restock_refunded_items', $refunded_item_quantity, false );
$item->save();