Skip to main content

Install the AfterShip protection widget on Magento-2 store

Learn how to install the AfterShip Protection widget on your Magento 2 store by generating an app key and inserting a custom script into your checkout template.

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.

  1. Go to STORES > All Stores

  2. Click the target store entry detail page

  3. 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

  1. 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>

  2. Merchant locates the file */vendor/magento/module-checkout/view/frontend/templates/onepage.phtml on the server.

3. 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.

Did this answer your question?