Skip to content

Commit f69d126

Browse files
committed
Add check to prevent refunds with empty line items
1 parent 0f5dd77 commit f69d126

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

includes/Generator/Order.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,11 @@ protected static function create_refund( $order, $force_partial = false ) {
493493
}
494494
}
495495

496+
// If no line items to refund, return false
497+
if ( empty( $line_items ) ) {
498+
return false;
499+
}
500+
496501
// Calculate the total refund amount from line items and count items
497502
$refund_amount = 0;
498503
$total_items = 0;

0 commit comments

Comments
 (0)