0

I wanted to delete a wrong credit memo so I deleted the wrong credit memo entry from sales_creditmemo and sales_creditmemo_grid. The listing of grid and credit memo is gone but when I view my order I could see refunded amount and comments about refund and the status of some product can also be seen as refunded .

enter image description here

So can someone explain what else I have to delete to completely get rid of credit memo information and also what is magento way of deleting a credit memo, does even magento provide a way to delete credit memo?

  • The answer your looking for is in the sales_order table you need to make sure columns related to refund are set to null and 0 as for the comment you can remove this in sales_order_status_history – Dava Gordon Aug 21 at 10:09
0

Create Custom Script Like This :-

\Magento\Sales\Model\OrderFactory $orderFactory

 $orderId = '1234546';

$order = $this->orderFactory->create()->load($orderId);

$_creditmemos = $this->Order()->getCreditmemosCollection();

      if($_creditmemos){
          foreach($_creditmemos as $_creditmemo){
              $_creditmemo->delete();
          }
      }

You Can Download Module For Delete Credit Memo :-

delete credit memo

  • @rathod thanks for the script , i deleted it through mysql by i guess this will be a much better way , will it also revert the status of refunded from the products whose status changes by creating credit memo ? – Kumar Aug 13 at 4:55

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.