Receipt with multiple cart items in SendGrid

I’m using the SendGrid plugin, and want to set up a receipt containing one line per item in the shopping cart, followed by the price of the item, preferably on the same row. Something like:

Item 1 20 USD
Item 2 60 USD
Item 3 10 USD

I could set it up using %VAR1%, %VAR2% etc, but that doesn’t seem to the most flexible solution. I’m sure I’m not the first to want to set this up, so I thought I’d ask if anyone has done anything clever to make this work.

(I’m also open to using an attached PDF instead of in the mail itself, if this is an easier solution).

1 Like

This actually turned out to be pretty easy, so I’ll jot down how we did it here, in case someone finds this thread in a search:

  1. Set up two columns in the Sendgrid template, with one variable in each column, like the one below. In our case, the item name goes on in the left column (Var1), and price goes in the right column (var2)

  2. Set up the list in each variable separated by line breaks. In our case, it was more or less like this: Parent Groups’ Shopping Cart’s Item’s Name:joined_by “line_break”

  3. You need to replace the \n line break with a traditional HTML
    . You do this by using the find & replace function like this. Don’t forget to check Use a regex pattern

Rinse and repeat for the right column, and voila! You have yourself a tidy receipt with all items.

Thanks to @copilot for the plugin, and for explaining the line break fix!