How do I add a Track & Trace number to an email sent from Magento?
A shipment in Magento is created in two steps. In the first step, the shipment is created and the products that were shipped are specified. In the second step, the Track & Trace number is added to the shipment.
By default, Magento sends an email to the customer after the first step. Since the second step has not been completed, the email does not include a Track & Trace number.
We solve this by having Magento send the email only after the second step, instead of after the first.
Adjust Magento settings in Picqer
Navigate to Settings > Webshops > Your Magento shop in Picqer.
Click Edit in the top right corner.
Change the setting Use tracking number workaround to Yes.
Create a new template in Magento
Log in to your Magento admin and navigate to System > Transactional Emails.
Click Add new Template.
Select New Shipment for Template.
Click on Load Template to load the template content.
Give the template a name in Template Name.
Click Save Template in the top right corner.
Repeat these steps for the template named New Shipment for Guest, so that the email for guest orders is also updated.
Switch the Magento templates
Log in to your Magento admin and navigate to System > Configuration > Sales > Sales Emails.
Click on Shipment Comments and set Enabled to Yes.
For Shipment Comment Email Template, select the template for the email you just created.
For Shipment Comment Email Template for Guest, select the template for the email for guest orders that you just created.
Click Save Config in the top right corner.
From now on, when a Track & Trace number is pushed from Picqer to your Magento shop, the customer will receive an email with the Track & Trace number of that shipment.