2

I know one way:

base_grand_total = base_total_invoiced
base_grand_total = base_total_refunded

but I have that stupid rounding issues and this way is not convenient. Maybe you know something else? Compare qtys?

3

You can check if an order is fully invoiced by calling: $order->canInvoice(). This may return false if the order is on hold or canceled. If that does not fit your needs you can check like this:

    $isInvoiced = true;
    foreach ($order->getAllItems() as $item) {
        if ($item->getQtyToInvoice()>0 && !$item->getLockedDoInvoice()) {
            $isInvoiced = false;
            break;
        }
    }
    //do something with $isInvoiced

For credit memo you can check $order->canCreditmemo() but again you can get false positives. If that doesn't work for you try :

$isFullCretitmemo = false;
if (abs($order->getStore()->roundPrice($order->getTotalPaid()) - $order->getTotalRefunded()) < .0001) {
    $isFullCretitmemo = true;
}
//do someting with $isFullCretitmemo
2
  • hi @marius you have checked in order level but how to know whether the invoice is totally refunded or not. I mean if order contains multiple invoice's and if we try to refund then which invoice we have to pick and process refunds - Programmatically Jan 5 '19 at 7:29
  • please help me out Jan 5 '19 at 7:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.