Cart Loop Tags

The cart loop tags allow Bronto to read through the array of line items associated with a shopping cart or an order and dynamically insert that data into an email message.

Important: This topic only applies to you if you pass either cart or order data from your site into Bronto.

Cart loop tags begin with {cart_loop}, contain a list of cart/order line item tags, and ends with {/cart_loop}. When a cart loop is included in a message, Bronto will look at the line items in an abandoned cart and include the data that matches each tag for every line item in the cart. So if your cart loop is:

{dynamic_code}
	{cart_loop limit=5}
		%%$cart.item.name%% 
		%%$cart.item.description%% 
		%%$cart.item.image%% 
	{/cart_loop}  
{/dynamic_code}	

and a contact has 3 abandoned items in a cart, then the name, description and image for those 3 items will be included in the message.

You have the option of including a limit to the number of items that will be included in the loop. In the example above, the limit is set at 5. If there were more than 5 items in the cart, only the first 5 will be included in the message. When you do not specify a limit, all of the items in a cart are included in the message.

If you include a cart loop tag in an HTML message, you must wrap the cart loop in a dynamic code tag. If you're using the email message editor, there is a cart loop tag element you can add to the canvas.

The message can be sent via a workflow using the Cart Is Abandoned trigger node.

Note: Cart and order tags can only be used in messages sent via a workflow that is triggered by the Cart Is Abandoned, the Order Is Added, or the Order Is Shipped nodes.

Inside of the {cart_loop} tag, the line item data can be accessed using the following tags:

Tag Syntax Description
%%$cart.item.sku%% SKU associated with a specific item in the shopping cart.
%%$cart.item.category%% Category associated with a specific item in the shopping cart.
%%$cart.item.createdate%% Date the item was added to the cart.
%%$cart.item.currency%% Currency associated with a specific item in the shopping cart.
%%$cart.item.description%% Description associated with a specific item in the shopping cart.
%%$cart.item.imageurl%% URL pointing to an image associated with a specific item in the shopping cart.
Note: The Shopify Connector currently does not import the product URLs or image URLs from cart events into Bronto, but can import these from your product feed. If your product catalog is up-to-date in Bronto, you can pull product URLs or image URLs from the catalog in order to use them in Cart Recovery messages. For more information see Include Product Data In Cart and Order Tags.
%%$cart.item.name%% Name associated with a specific item in the shopping cart.
%%$cart.item.other%% Additional data associated with a specific item in the shopping cart.
%%$cart.item.position%% Position associated with a specific item in the shopping cart.
%%$cart.item.unitprice%% Unit price associated with a specific item in the shopping cart.
%%$cart.item.saleprice%% Sale price associated with a specific item in the shopping cart.
%%$cart.item.quantity%% Number of units associated with a specific item in the shopping cart.
%%$cart.item.totalprice%% Total price associated with a specific item in the shopping cart.
%%$cart.item.producturl%% URL pointing to the product associated with a specific item in the shopping cart.
Note: The Shopify Connector currently does not import the product URLs or image URLs from cart events into Bronto, but can import these from your product feed. If your product catalog is up-to-date in Bronto, you can pull product URLs or image URLs from the catalog in order to use them in Cart Recovery messages. For more information see Include Product Data In Cart and Order Tags.
%%$cart.numItems%% The number of items in the cart.

To use the {cart_loop} tag:

  1. Go to Messages > All Messages.
  2. Create a new message or edit an existing message.
  3. Add {dynamic_code}{cart_loop}{/cart_loop}{/dynamic_code} tags to the body of the email message as shown below:
    
    
    <table border="1">
    	<tbody>
    		<tr>
    			<th>Cart Item Name</th>
    			<th>Cart Item Category</th>
    			<th>Cart Item Description</th>
    			<th>Cart Item Other</th>
    			<th>Cart Item SKU</th>
    			<th>Cart Item Price</th>
    			<th>Cart Item Sale Price</th>
    			<th>Cart Item Quantity</th>
    			<th>Cart Item URL</th>
    			<th>Cart Item Image</th>
    		</tr>
    		{dynamic_code}{cart_loop}
    			<tr>
    				<td>%%$cart.item.name%%</td>
    				<td>%%$cart.item.category%%</td>
    				<td>%%$cart.item.description%%</td>
    				<td>%%$cart.item.other%%</td>
    				<td>%%$cart.item.sku%%</td>
    				<td>%%$cart.item.unitprice%%</td>
    				<td>%%$cart.item.saleprice%%</td>
    				<td>%%$cart.item.quantity%%</td>
    				<td>%%$cart.item.producturl%%</td>
    				<td><img src="%%$cart.item.imageurl%%" border="0" style="display: block;" /></td>
    			</tr>
    		{/cart_loop}{/dynamic_code}
    	</tbody>
    </table>
    
    					
    Shopping Cart Loop Tags In A Message
    Tip: In the example above, notice how the {dynamic_code}{cart_loop}{/cart_loop}{/dynamic_code} tags have been placed inside of an HTML table. This was done so the content brought in via the {dynamic_code}{cart_loop}{/cart_loop}{/dynamic_code} tags will display nicely in a table. It is perfectly ok to do this, but you will need to TURN OFF the WYSIWYG editor (as is the case above) when working with dynamic code and HTML. The WYSIWYG editor attempts to correct what it sees as mistakes in HTML and will thus produce unintended results if it encounters dynamic code embedded in HTML. To turn off the WYSIWYG editor, click WYSIWYG Editor Off next to the Subject Line text box.
    Tip: The above example is very basic and would produce something similar to the following when the message is sent: Shopping Cart Loop Tags Result
  4. Click Create New Workflow to create a new workflow, or click on the name of an existing that is triggered by the Cart Is Abandoned workflow trigger node.
  5. If you are creating a new workflow, add the Cart Is Abandoned trigger node to the workflow canvas.
  6. Drag the Send Email node on to the workflow canvas.
  7. Click the following text in the Send Email action node: marketing.
  8. From the pull-down menu choose either marketing or transactional.
    Important: Some countries do not allow cart recovery messages to be sent as transactional messages. In these locations, cart recovery messages must be sent as marketing messages. Check your local regulations before sending your message as transactional.
  9. Click the following text in the Send Email action node: an email message.
  10. Select the message you added the {cart_loop} tag to.
  11. Click Save And Close.
  12. Click the toggle in the Status column to enable the workflow you just created.
Note: Cart tags are populated with data captured from your site according to selectors you define on the Cart View page. For information see Add Cart Views For Shopping Cart Abandonment.

For more information on creating workflows, see Workflows.

Tip: A workflow can be filtered based on the status of a contact's cart using the Cart Status filter node. For more information on using the Cart Status filter node, see Use The Cart Status Filter Node In Workflows in help