1

How can I make magento automatically email invoice/shipment after I create them.

what happens now is that:

1) I a create the invoice/shipment and then

2) I open the invoice/shipment and press send email.

I don't want to do the second step, I want the email to be send once the invoice/shipment created.

4
  • is this Magento behavior actually normal ?? or do I have some sort of a problem ?? Commented May 1, 2016 at 20:43
  • Yes, you should be able to have emails send immediately once they are created, it's core behaviour. Which version are you running? If it's a recent version, do you have the Magento cron job configured and running correctly? Commented May 1, 2016 at 23:02
  • See this answer: stackoverflow.com/a/13285003/2812842 Commented May 1, 2016 at 23:08
  • I have magento 1.9.2.4. cron job is running without a problem Commented May 2, 2016 at 11:54

2 Answers 2

2

you need to look at this magento event sales_order_shipment_save_after.

So in app/code/local/Namespace/Module/etc/config.xml:

... <events> <sales_order_shipment_save_after> <observers> <namespace_module> <type>singleton</type> <class>Namespace_Module_Model_Observer</class> <method>autoEmail</method> </namespace_module> </observers> </sales_order_shipment_save_after> </events> .... 

and in app/code/local/Namespace/Module/Model/Observer.php:

 <?php class Namespace_Module_Model_Observer { public function autoEmail($observer) { $shipment = $observer->getEvent()->getShipment(); $order = $shipment->getOrder(); // your email triggering code here. } } 
1

I found the reason, it is a very silly mistake

when I create the invoice/shipment I don't click (Email Copy of invoice/Shipment).

I was thinking this will send a copy of the email to me, but when I tried it out. I found it is for sending a copy to the customer

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.