cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot send tracking number in shipment email when creating shipment from API

Cannot send tracking number in shipment email when creating shipment from API

 

Hi, I'm creating shipment and tracking number by calling APIs i.e. sales_order_shipment.create and sales_order_shipment.addTrack. APIs are running fine, they are creating shipment and generating tracking number, But when I try to send tracking number in shipment email through the following code (in shipment email template):

Tracking Number: {{block type='core/template' area='frontend' template='email/order/shipment/track.phtml' shipment=$shipment order=$order}}

the shipment email comes empty and when I remove this code the email comes fine but without tracking number, Everything runs fine when I create shipment from Admin i.e. the shipment email comes fine along with the tracking number. What's causing the problem? Is there any other way to send tracking number in shipment email?

9 REPLIES 9

Re: Cannot send tracking number in shipment email when creating shipment from API

Hello @tajveez_rehman 

 

check below two link will be helpful

 

https://magento.stackexchange.com/questions/96582/shipping-email-ignored-when-api-sends-tracking-num...
https://www.customerparadigm.com/magento-api-shipping-email-notification-bug-solved/

 

if works then mark as solution

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Cannot send tracking number in shipment email when creating shipment from API

Hi @Sunil Patel

 

Thanks for the links I'm looking into these, I have noted that $shipment in the following code:

Tracking Number: {{block type='core/template' area='frontend' template='email/order/shipment/track.phtml' shipment=$shipment order=$order}}

 present in my shipping email template doesn't get any value when Its called from APIs otherwise when we create shipment and tracking number from backend it works fine. What can be the problem here

Re: Cannot send tracking number in shipment email when creating shipment from API

Hello @tajveez_rehman 

 

https://support.theredrook.com/support/solutions/articles/17000063866-enhanced-magento-1-api-for-sen...

 

download module from above link and install it and check it.

 

if works then mark as solution.


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Cannot send tracking number in shipment email when creating shipment from API

I'm still getting blank shipment email

Re: Cannot send tracking number in shipment email when creating shipment from API

Hello @tajveez_rehman 

 

 

have you enabled this setting?


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Cannot send tracking number in shipment email when creating shipment from API

Yes, it's enabled. This code in email template:

{{block type='core/template' area='frontend' template='email/order/shipment/track.phtml' shipment=$shipment order=$order}}

makes email go blank when I remove this code from my email template the email comes fine, this code calls a template that shows tracking number in the email. There's no trouble with this code when sending shipment email from adminpanel

Re: Cannot send tracking number in shipment email when creating shipment from API

Hello @tajveez_rehman 

 

can you check is any module override same file and little bit debug with that zip file module

 

is that calling or not

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Cannot send tracking number in shipment email when creating shipment from API

There's no other module overriding it. and the module that you suggesting running fine but the create method in V2.php is not running instead, create method in Api.php file is running and also addTrack method in Api.php is also running

Re: Cannot send tracking number in shipment email when creating shipment from API

Hi I recommend TrackingMore plugin. https://www.trackingmore.com/apps-magento.html It's much easier than do it yourself.

  • Support delivery tracking of 410 couriers, including major carriers like USPS, UPS, FedEx, DHL
  • Support multi-store connector and management
  • Auto import and track shipments from Magento shop every 8 hours
  • Store detailed package information all in one panel, easy to know shipping performance
  • Allow your site customers to check shipment progress easily within your store
  • Reassure your customers by sending email/SMS notifications to notify them when order status changes