I have an order with processing status and its invoice is canceled.
When I use the order->canCancel()
function, It returns me false
.
I checked the core and this is the part why I am getting false
:
$allInvoiced = true;
foreach ($this->getAllItems() as $item) {
if ($item->getQtyToInvoice()) {
$allInvoiced = false;
break;
}
}
if ($allInvoiced) {
return false;
}
This is my custom code:
foreach ($invoice->getAllItems() as $item) {
echo '<pre>'; var_dump($item->getQty());
}
...
if ($orderObject->canCancel()){
}
The result of the var_dump
is 4
in my case. Then why the $item->getQtyToInvoice()
returns me 0
or false
?