Add Track Button to PrestaShop Store (Version 1.7.6.5)
Overview
PrestaShop is an open-source eCommerce solution. You can enhance the post-purchase experience by embedding the AfterShip track button directly into your Order History Page. This allows customers to easily track their shipments from over 700 carriers, all from your store.
Insert track button to Order History Page
Edit Theme File (order-detail.tpl)
- Go to the start menu > FTP > Select your FTP location > Theme folder > Search for order-detail.tpl file.
- Search for the following code:
undefined <td>{$line.trackingnofilter}</td>
Replace it with the below-mentioned code snippet and save changes
<td>{if $line.tracking&& $line.tracking !== '-'}{literal}<divid="as-root"></div><script>(function(e,t,n){var r,i=e.getElementsByTagName(t)[0];if(e.getElementById(n)){aftership.buttonCreator.create();return;}r=e.createElement(t);r.id=n;r.src="//button.aftership.com/all.js";i.parentNode.insertBefore(r,i)})(document,"script","aftership-jssdk")</script>{/literal}<div class="as-track-button" data-domain="track.aftership.com" data-size="small" data-tracking-number="{$line.tracking}"></div>{else}-{/if}</td>
Failed to add track button
If the track button is not added after the modification of FTP file, follow the below-mentioned steps:
- Go to PrestaShop admin panel > Advanced parameters > Performance > Clear cache.
- Recompile templates if the files have been updated > Save changes.
FAQs
1. What is the purpose of the AfterShip Track Button?
The AfterShip Track Button allows customers to track their orders directly on your store’s Order History Page, using real-time data from over 700 couriers supported by AfterShip.
2. Can I add the track button elsewhere, like on the order confirmation page?
Yes, you can. The track button can be embedded on any PrestaShop page that outputs a valid tracking number. You'll need to insert the same script into the relevant template file and reference the appropriate tracking variable.
Key takeaways
- The AfterShip Track Button provides real-time tracking directly on the Order History Page.
- Code updates must be made in the order-detail.tpl file under your theme directory.
- If the button doesn’t appear, clearing the cache and recompiling templates usually resolves the issue.
Updated on: 09/06/2025