I have created a shipment by adding Tacking info. I am getting the shipment email with empty Tacking info.
Next time if i click on "send Tracking Information. Then I will get the tracking info in shipment email.
My Magento version is 2.3.5
here is the screenshot of shipment email
I need to get this info during shipment creation.
Hopefully its because i used this event to send shipment email automatically whenever the shipment is created.
Vendor/Module/etc/events.xml
<event name="sales_order_shipment_save_after">
<observer name="sales_order_shipment_after"
instance="Vendor\Module\Observer\SalesOrderShipmentAfter" />
</event>
Vendor/Module/Observer/SalesOrderShipmentAfter.php
use Magento\Framework\Event\ObserverInterface;
class SalesOrderShipmentAfter implements ObserverInterface
{
protected $shipmentNotifier;
protected $_logger;
public function __construct(
\Psr\Log\LoggerInterface $logger,
\Magento\Shipping\Model\ShipmentNotifier $shipmentNotifier
) {
$this->_logger = $logger;
$this->shipmentNotifier = $shipmentNotifier;
}
public function execute(\Magento\Framework\Event\Observer $observer)
{
try{
$this->_logger->info('inside shipment observer');
$shipment = $observer->getEvent()->getShipment();
$this->shipmentNotifier->notify($shipment);
//$shipment->save();
}catch (\Exception $e) {
$this->_logger->info('--shipment observer--'.$e->getMessage());
}
}
}
Can anyone please help me on this. Thanks