The orders status gets updated to "closed" after I do a full refund for every order except for those paid using a gift card.I am able to manually set the order to "closed" using the following code:

$order->setData('state', 'complete');
$history = $order->addStatusHistoryComment('Manually set order to Complete.', false);

This shows on the Magento Admin web too but right after, some event if triggered which sets the status back to "Completed". I use the following code to process a refund to giftcards:

$creditmemo = $serviceOrder->prepareInvoiceCreditmemo($invoice,$data);
$transaction = Mage::getModel('core/resource_transaction');

Your Answer

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

Browse other questions tagged or ask your own question.