Skip to content

Commit 34409a8

Browse files
committed
Add Guard Clause to check if invoice has been canceled previously
1 parent 0f71c20 commit 34409a8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/code/Magento/Sales/Model/Order/Invoice.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,10 @@ public function void()
407407
*/
408408
public function cancel()
409409
{
410+
if (!$this->canCancel()) {
411+
return $this;
412+
}
413+
410414
$order = $this->getOrder();
411415
$order->getPayment()->cancelInvoice($this);
412416
foreach ($this->getAllItems() as $item) {

0 commit comments

Comments
 (0)