Integrating Post Purchase

Learn how to integrate and setup the Extend aftermarket modal to enable customers to get the most out of Extend!


The Post Purchase modal gives customers the ability to purchase Extend Protection Plans on products purchased without a warranty. This provides customers the ability to maximize the use of the Extend partnership in your site! We do this by giving your site the ability to produce a modal when a certain parameter [/?leadToken={lead_token}] is appended to your sites URL.

This gives you the ability the process the transaction on your end and more importantly gives you the ability to upsell the customer on any products on your site.

Est. Time of Completion: 30 minute(s)


  1. Under Snippets click Add a new snippet.

  1. Add the following file and insert the respective code:
  • extend-aftermarket-integration

  window.addEventListener('DOMContentLoaded', function () {

    if (window.Extend && window.ExtendShopify && window.Shopify && window.Shopify.currency && === 'USD') {

      const params = (new URL(document.location)).searchParams;

      let leadToken = params.get('leadToken') ? params.get('leadToken') : params.get('leadtoken');

      if (leadToken) {{
          leadToken: leadToken,
          onClose: function (plan, product, quantity) {
            if (plan && product) {
              ExtendShopify.addPlanToCart({ plan: plan, product: product, leadToken: leadToken, quantity: quantity || 1 }, function () {
                window.location = '/cart'





  1. Open the preview of the theme you are working on:
    Helpful Tips: Right click the Preview Theme button and click Open in new Tab

  2. We append lead token we generated beforehand and append it to this:
    Note: If you don't have the lead token please reach out through a Support Ticketfor our Associate to provide one for you.

  3. After this we should see the below modal:

If you run into any issues during this integration process or have questions please reach out to our team through your Merchant Portal.