How to use the {items_data} tags in the email body and subject

Using {items_data} is a bit tricky.
For example, to print the name of the first order item, write:

{$items_data[0].name}

Instead of "name" you can use "sku", "qty", "price", "product_id", "url", "thumb" ("thumb" is the image url).

To print the price of the second item, write:

{$items_data[1].price}

In order to print all items images, do something like this:

{foreach $items_data as $item_row} 
<img src="{$item_row.thumb}" />
{/foreach}

Important notice: Before you can print any item property, the data need to be prepared. It is done by writing once, somewhere in the email, above the first use of the tags: {items_data}. This will not print anything, just prepare the items data.

How to use this tags in the subject line?, add {items_data} before printing items property, for example:

{items_data}Thank you for ordering {$items_data[0].name}

 

Cheers,

Tzvika

Have more questions? Submit a request

1 Comments

  • 0
    Avatar
    Info

    I've created a ticket for this (before I found this post sorry). I would've kept it in here as it may help someone else down the road.

     

    I've created the foreach loop, but in a list of multiple items it only lists the name ({$items_data[0].name}). This is simply a small error in the tooltip instructions which lists to use:

     

    {foreach $items_data as $item_row}

    {$items_data[0].name}

    {/foreach}

     

    In the loops of course "$items_data[0].name" should be listed as $item_row.name and so on; this may not be obvious to others.

     

    Cheers.

Please sign in to leave a comment.