All Collections
Emails
FAQ
How To Create “Add All items to Cart” button In Abandoned Cart Email ?
How To Create “Add All items to Cart” button In Abandoned Cart Email ?

Abandoned cart email - creating ALL ITEMS TO CART button

Dan Macarie avatar
Written by Dan Macarie
Updated over a week ago

Nosto’s Abandoned Cart Email are thoroughly tested across multiple devices and email service providers for maximum compatibility right out of the box. Once you start customizing email templates you will need to consider e-commerce solution specific properties and do a lot of testing and bug fixing fe. your shop solution will probably use a distinct syntax in their URL parameters. That is why Nosto does not include a button adding all items to cart in the email template.

This feature however might come in handy since customers might use full screen devices to shop for items but mobile devices for reading mail. Thus the persistent shopping cart feature will not work on the go (check the amount of mobile traffic you have before considering implementing this feature).

Adding an ‘Add All Items to Cart’ inside the email template can overcome that issue by bringing the customer straight to cart with all previous cart items “waiting” in the basket.

You can add this feature by familiarizing yourself with the concept of URL parameterization or restore link, in case your e-commerce platforms supports the feature.

By far the easiest way to add cart recovery link in abandon cart emails is to map cart restore link directly in the implementation as a part of the cart tagging. As a requirement, your e-commerce platform needs to support the functionality.

From technical point of view the functionality is pretty simple. The restore link is a permanent link to the cart content on the site and when a customer clicks the link populated in an abandon cart email, the cart is recovered.

Since this is the least complex method to add a cart recovery link in to emails, we recommend to explore the possibility with your platform provider or partner.

Url Parametrization

The goal is to create an URL that is accepted by your e-commerce platform and will add the right item in the right quantity (and possibly color and size) to the cart. Not all e-commerce platforms include this feature, so first find out if your solution accepts URL parameters and what distinct ‘add to cart’ URL is defined. (Please note that add to cart URL is not necessarily the same as the one you see when you browse your cart manually)

Essentially, you need to create an array of product ids and product quantities (and possibly color and size) and use a loop function to add these strings to the URL.

 

1) Check that the necessary variables such as ID and quantity are tagged in the cart page (https://connect.nosto.com/tagging#tag_cart)

 

2) Define the necessary variables in the HTML editor inside the Nosto Email campaigns page:

## Iterators
#set($productCount = 1)

## URL for adding products to the cart

#set($addToCartURL = "http://yourshopurl.com/your_cart_page.html?")

## Variable for the product IDs that should be added to the cart

#set($addToCartProductId = "&product=")

## Variable for the product quantities

#set($addToCartProductAmount = "&quantity=")

3) Create the array using a loop function:

#foreach($item in $Cart.items)

  #set($addToCartProductId = $addToCartProductId+$item.product.productId)

  #set($addToCartProductAmount = $addToCartProductAmount+$item.quantity)

  #if($productCount < $Cart.items.size())

    #set($addToCartProductId = $addToCartProductId+",")

    #set($addToCartProductAmount = $addToCartProductAmount+",")

    #set($productCount = $productCount+1)

  #end

#end

4) Create the URL:

#set($cartLinkUrl=$addToCartURL+$addToCartProductId+$addToCartProductAmount+$nostoUrlRef+"&utm_source="+$settings.utm_source+"&amp;utm_medium="+$settings.utm_medium+"&amp;utm_campaign="+$settings.utm_campaign+"&amp;utm_content="+$content.recommendationType)

5) Use the newly created URL in the actual add to cart button link:

<a href="$cartLinkUrl">Add all items to shopping cart</a>
Did this answer your question?