Install the AfterShip protection widget on Magento-2 store
Overview
To activate the AfterShip Protection widget on your Magento 2 store, youโll need to retrieve a unique app key and add a script to your checkout template. This guide walks you through all the steps required to get the widget up and running smoothly.
Install Protection widget on your Magento-2 store would require 3 simple steps.
Step 1. Get Magento-2 store appKey in your store admin site.
- Go to STORES > All Stores
- Click the target store entry detail page
- Find a number after
website_id
, and combine the store URL with the appKey we need.
appKey format: Store URL|[the number after website_id]
Take the demo store screenshot below as an example, the appKey should be magento10.XXX.com|1
Step 2. Insert the script into Magento-2 checkout template
- Replace
***appKey***
with the appKey we found in the last step in the code.
<script async type="text/javascript" src="https://widgets.automizely.com/protection/magento2/checkout.min.js?appKey=***appKey***"></script>
- Merchant locates the file
*/vendor/magento/module-checkout/view/frontend/templates/onepage.phtml
on the server.
- The path of the file could be different depending on the user installation of the store.
- The content in the file should be the same as https://github.com/magento/magento2/blob/2.4develop/app/code/Magento/Checkout/view/frontend/templates/onepage.phtml.
- Merchant copy & paste the code append into the file.
Step 3. Check if the Protection widget shows up correctly on the checkout page.
Key takeaways
- You must generate a unique appKey using your storeโs URL and website_id.
- The widget script must be added manually to the onepage.phtml checkout template file.
- Ensure the script is correctly placed and your Magento cache is cleared to activate the widget.
- Always back up the template before making changes to avoid disruptions during updates.
Updated on: 11/06/2025