Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
## Adding Google Form to Receipt
01-27-2020
#parse('/system/checkout/receipt_survey.vm')
## End Google Form to Receipt

...

Info

Make sure to add comments to easily identify this customization, in order to make the theme upgrades as seamless as possible.

Adding conditional logic to display the survey based on an item or items in the checkout

You may wish to have the survey displayed in the receipt only when certain items are purchased.

We can do this by wrapping the parse statement in the receipt.vm with a IF statement.

That code snippet looks like this:

Code Block
## Adding Google Form to Receipt
#if($order.ifPurchased("ITEM_ID"))
  #parse('/system/checkout/receipt_survey.vm')
#end
## End Google Form to Receipt

With the conditional if statement, we're checking the Order object for a particular item has been purchased.

Info

Make sure to replace ITEM_ID with the actual itemID of your item (leave the double quotes).

If you have multiple items that should be a trigger for this conditional logic, separate each itemID with a comma!

Related Documentation

Velocity Coding Example - Receipt Conditional Text From Item Attribute

Order SFO