0

When I created the credit memo, it refunded the full amount instead of the amount i needed to refund! Is there anyway to cancel the credit.

Also the credit memo situation needs to be fixed ASAP. It is too confusing when needing to create a partial refund!

3 Answers 3

1

A colleague of mine did some research and this SQL queries should revert a credit memo. This should work, if there was only one credit memo - always use at your own risk. Make backups. Use with care.

In Magento 2 you can undo a credit memo as follows. It should be an offline payment, because, of course if a refund already was sent to the customer, that can not be undone.

Replace the : variables by your order and credit memo IDs.

DELETE
FROM sales_creditmemo
WHERE entity_id = :entity-id-of-credit-memo;

DELETE
FROM sales_creditmemo_grid
WHERE entity_id = :entity-id-of-credit-memo;

UPDATE sales_order_item
SET amount_refunded                         = NULL,
    base_amount_refunded                    = NULL,
    discount_tax_compensation_refunded      = NULL,
    base_discount_tax_compensation_refunded = NULL,
    base_tax_refunded                       = NULL,
    discount_refunded                       = NULL,
    base_discount_refunded                  = NULL,
    qty_refunded                            = NULL
WHERE order_id = :entity-id-of-the-corresponding-order;

UPDATE sales_order
SET state='processing',
    status='processing',
    base_shipping_refunded=NULL,
    base_shipping_tax_refunded=NULL,
    base_subtotal_refunded=NULL,
    base_tax_refunded=NULL,
    base_total_offline_refunded=NULL,
    base_total_refunded=NULL,
    discount_refunded=NULL,
    shipping_refunded=NULL,
    shipping_tax_refunded=NULL,
    subtotal_refunded=NULL,
    tax_refunded=NULL,
    total_offline_refunded=NULL,
    total_refunded=NULL,
    adjustment_negative=NULL,
    adjustment_positive=NULL,
    base_adjustment_negative=NULL,
    base_adjustment_positive=NULL,
    discount_tax_compensation_refunded=NULL,
    base_discount_tax_compensation_refunded=NULL
WHERE entity_id = :entity-id-of-the-corresponding-order;

UPDATE sales_order_grid
SET status='processing',
    total_refunded=NULL
WHERE entity_id = :entity-id-of-the-corresponding-order;

DELETE
FROM sales_order_status_history
WHERE entity_id = :entity-id-of-the-corresponding-order
  AND status = 'closed';
3
  • Thank you Alex greatly for these queries. I created a creditmemo and accidentally made it offline (money was not returned to customer). After I realized my mistake, I went and created an actual refund on the Payment Gateway. To my surprise, the Payment Gateway communicated back to Magento and created another offline creditmemo to reflect the action I did on their dashboard. So now Magento had 2 creditmemoes. I'm trying to delete the second one which did not specify the items and will keep the first one. Nov 5, 2023 at 21:21
  • Okay, these queries work only if there was only one credit memo - to fix a bigger mess, adaptions are needed :-)
    – Alex
    Nov 6, 2023 at 17:28
  • 1
    Thank you for your reply. They worked fine thought. I totally deleted one of the credit memos successfully. Obviously had to edited few values in the queries you mentioned like instead of setting Total Refund to Null, I deducted the amount of the Credit Memo I'm deleting (luckily was an easy number of $15) and kept the remaining. And Order status was Completed so I didn't need to reset that, and didn't need the last query to delete a Closed order History, and this particular order didn't have tax, again, luckily. Otherwise, as you mentioned, it would have been a much much bigger mess. Nov 10, 2023 at 4:41
0

Out of the box Magento don't let you cancel a Credit Memo, it's not Magento order flow.

If you refund online, cancel a Credit Memo would mean that you get the money back you refund minutes ago, right?

It would also mean that you have your customer Credit Card token and you are authorized to use it.

3
  • Unless it was an offline Credit Memo and the admin made a mistake processing it (wrong amount / items) and they would like to do it again, how would they go about that? Jul 9, 2022 at 5:59
  • Same for offline, you can't undo through backoffice. Only on database but not easy stuff, lots of fields to update... Jul 9, 2022 at 13:21
  • Thank you for your reply. Yup, many steps and error prone to do apparently. I was describing a scenario to address your point how the refund will work, and that is a valid point because really, what does canceling credit memo mean here so it doesn't make sense to implement. But for offline credit memo, it may be worth implementing. Thank you for your reply though. Jul 11, 2022 at 4:51
0

Looking at the previous answers for this Magento CM Cancel requirements, nothing has changed as of 2020. You still cannot "cancel" a Credit Memo as an admin level user. Only way to "Close" a CM is through the source code, which can be done by the IT guys if your company has them to oversee IT user requirements.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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