Skip to main content
All CollectionsCommerceAbandoned carts
Abandoned carts - link to cart URL
Abandoned carts - link to cart URL
Gareth Burroughes avatar
Written by Gareth Burroughes
Updated over 4 months ago

Dotdigital for Adobe Commerce (Magento) or Shopify connector user?

If so, abandoned cart functionality is configured and implemented differently - and the information below does not apply.

Learn more in the Dotdigital for Adobe Commerce or Shopify connector articles.

In our abandoned cart questionnaire, there is one question regarding the link URL:

Is it possible to access an abandoned cart from a single URL?

We require this so that your customers can return directly to their shopping cart by clicking a link on the abandoned cart email that they receive from us.

To guide you, this article helps you to understand how this can potentially be achieved.


The process

A user adds several items to their cart. They then abandon their cart. Sometime later, say, 20 minutes, we send them an email saying something along the lines of, You have abandoned your cart. Want to continue?.

In opting to continue, the user clicks a link in that email.

Ideally, that link takes them back to your website, and the items they previously added to their cart are still there, ready for them to purchase.

It's important to note here that your customer may not pick up that email on the same device that they originally created the cart on. For example, if they created the cart on their home PC, and then left the house, they could then receive the email on their mobile.


The challenge

You need to generate that link, and supply it as part of the JSON that you send to us.

That link has to be a single URL that returns the user to their cart, as outlined above.

The challenge is that many sites do not have a way to link back to a cart that hasn't been fulfilled.

Here are a few scenarios that may fit how your site works.

1: Carts are stored in a database on the server

This is the best possible scenario. Usually, if this is the case, the cart in your own database has an ID. Using this method, it should be possible to construct some URL that takes a user straight back to their cart. For example:

2: Carts are stored in browser cookies or local storage

Often an unfinished cart is not actually stored in a database, but is simply stored in a user's browser, either in cookies, or local storage.

In this case, their cart is often present when they return to your site, providing they are using the same device/browser. For example, if the link read:

They may navigate straight back to their partially completed cart, if it were stored in this way. The problem here is that we can't tell they are using the same device.

A possible solution is to encode the cart onto a URL, and then rebuild that cart when they revisit your site. For example:

That would add product ID 123 (quantity x 2), ID 345 (quantity x1), and so on.

Obviously, it would be up to your site's developer to introduce this mechanism, then they can build such a link as part of the code that generates the JSON.

3: Cart is stored in the database, but tied to a given user ID

In this scenario, the cart may be stored against a user who has logged into your website. This means that we can't simply recover the cart using a cart's ID, but require the user to log in.

So here, simply linking to the login page would be the best option:

To make things even better, it may be possible to navigate directly to the cart page after the user has logged in:

As an added benefit, if a user is using a machine that they have previously logged in on, then the above would probably navigate the user directly to the cart page, without even requesting that the user logs in.

4: Single item purchases

If none of the above are possible, but the customer is purchasing a single item, then simply linking back to that item may be the most sensible thing to do:

That way, they link straight back to a page which allows them to purchase right away without having to search for their chosen item again.

Did this answer your question?