Most ecommerces offer to their customers 2 basic options in cases when they wanna return one or more items to the store, for some reason such as wrong size or color, whatever. Those options are: choosing if they prefer either get a coupon in the purchase value or a refund using the same way the customer used to pay an order. In Magento is already possible to make a refund, online or manually, doesn't matter.

So now, I would like to know if would be possible generating a coupon automatically with a credit memo, maybe using a custom status like "voucher issued" and assigned to the "closed" state. I know that already there is some extensions to do that, but I'm not looking for extensions at this first time.

In summary, is it possible to do that programatically? Alternative ways could be help me a lot too.

1 Answer 1


I guess you want to create coupon automatically when you have create a credit memo.

In this case,event/observer is every useful.So on sales_order_creditmemo_refund event fire Observer.This observer,create coupon basic of refund

  • Yes, that's the idea, but in pratice I don't know how to do it, I mean, I don't know how to use event/observers. In which file should I put the code to create a coupon automatically? Feb 24, 2015 at 14:58
  • wait, i will give you solution,shortly
    – Amit Bera
    Feb 24, 2015 at 15:03

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.