Solved

Abandon Checkout Flow: How to display all products in cart

  • 21 February 2023
  • 2 replies
  • 2082 views

Badge +1

Hi,

I searched a bit on the form and noticed that a lot of the scripts were for Abandoned cart flows. Sorry ahead of time if this question has been answered - I haven't been able to find it through searching.

I was looking for a way to display products added to cart from Shopify to an Abandoned Checkout Flow. This flow starts with “User has started checkout”.

I have created a universal block before and attempted to get the dynamic info pulled where the item image is on the left column and the product information is on the right.

Img:

{% if item.product.variant.images.0.src %}{{item.product.variant.images.0.src}}{%else%}{{item.product.images.0.src|missing_product_image}}{%endif%}

Link:{{ organization.url|trim_slash }}/products/{{ item.product.handle }}


Text:

{{ item.product.title }}

Quantity: {{ item.quantity|floatformat:0 }} —
Total: {% currency_format item.line_price|floatformat:2 %}



The issue I am having is how this is displayed and attempting to show more than one product in the email. How would I go about showing if they had 2-3 items in their cart the other items so it is different and if they only have 1 item in the cart only showing the single product.

Is their an easier way to pull the information from a users checkout abandonment and show that in an email along with a link back to their cart?

Thanks.

B

icon

Best answer by retention 21 February 2023, 22:48

View original

2 replies

Userlevel 7
Badge +57

Hi @B Mo, welcome to the community!

To show more than one item, you need to loop over your items by specifying the “Rows” to be Dynamic, reference the data source “Row Collection” and give it an alias variable name.  Since you’re on Shopify, typically this is the event.extra.line_items data. 

You can specify this in the Table Block → Rows → Dynamic → Data Source like this:

Here, I’m relabelling each “row” of the event.extra.line_items as an “item.” 

Now, for each item in the event.extra.line_items, it will show your Table Row.  So if there are 2 items, there will be 2 rows.  If there are 3 items, there will be 3 rows and so on.

There’s some great documentation in Klaviyon on how to do this here:

Additionally, a quick shortcut instead of doing all of this manually, is to create a temporary new Flow from the Flow Library for a pre-built Abandoned Cart Flow, and then simply save the Table Block with the dynamic data in one of the messages.  You can then re-use that Saved Block in your Flow Message and just adapt it to suit your needs.  But I leave the specifics above in case you want to do it manually.

Hope this helps!

Badge

Hi there, I tried using this as a guide to build my abandoned checkout but I am having issues. For some reason, the dynamic content is showing the same product the amount of times of what they have in their cart. IE, if I had 4 tshirts in my cart, the code is showing 1 tshirt 4 times then it’s showing tshirt 2 4 times. I’m not sure what I am doing wrong. 

 

 

Any help would be appreciated. Thanks!

Reply