Porting IfPurchased Tokens on the legacy receipt over to Velocity

Overview

This tutorial will cover how to port existing [IfPurchase] HTML [/IfPurchased] snippets from your legacy Screen Branding Theme receipt over to the StoreFront Checkout.  

Legacy code

First let 's look at an example of the legacy code.

Let's take a closer look at the legacy token code outside of the screenshot.

Legacy Token Conditional Code
[IfPurchased=jdh-dvd-ah-md, jdh-sov-1x-ah-md, jdh-sov-90-ah-md,jdh-dvd-eh-yy, jdh-sov-1x-eh-yy, jdh-sov-90-eh-yy, jdh-dvd-rp-jd,jdh-sov-1x-rp-jd, jdh-sov-90-rp-jd]
<center><b>Also:</b> check out our friend Dusan Milenkovic' fantastic Jazz
Drum Transcription Book <a href="
http://dusanmilenkovic.com/promotional-video/" target="_blank">"The
Magnificent Seven"</a>! <br>(Transcriptions of Solos by Jeff "Tain" Watts,
Eric Harland, Bill Stewart & more)</center>
[/IfPurchased]

Porting Legacy to Velocity

Now let's port this over to Velocity code using the Order object that is available on the receipt page.  So the first thing we need to do is create a Velocity if statement that has the multiple conditions and call $order.isPurchase("itemId") multiple times.

Velocity IfPurchased Code
## COMMENT: This will output additional content on the receipt if the customer purchased one of these products.
#if ($order.isPurchased("jdh-dvd-ah-md") || $order.isPurchased("jdh-sov-1x-ah-md") || $order.isPurchased("jdh-sov-90-ah-md") || $order.isPurchased("jdh-dvd-eh-yy") ||$order.isPurchased("jdh-sov-1x-eh-yy") || $order.isPurchased("jdh-sov-90-eh-yy") || $order.isPurchased("jdh-dvd-rp-jd") || $order.isPurchased("jdh-sov-1x-rp-jd") || $order.isPurchased("jdh-sov-90-rp-jd"))
  <center>
    <b>Also:</b> check out our friend Dusan Milenkovic' fantastic Jazz
    Drum Transcription Book <a href="http://dusanmilenkovic.com/promotional-video/" target="_blank">"The Magnificent Seven"</a>! <br>(Transcriptions of Solos by Jeff "Tain" Watts, Eric Harland, Bill Stewart & more)
  </center>
#end

Now that we understand the code, we need install it into the receipt.  First click on the "Templates" tab on your StoreFront.

Now click on the "Checkout" section.

Scroll down and click on the receipt.vm file.

Now scroll to the bottom of the file.  Pay attention to the line numbers in the screenshot.  Install the code just above the order output as shown and Save.

Make sure you place a test order and confirm that your code is working properly.