I am getting this error when trying to send a confirmation email to the user.

Template error: “Variable "option" does not exist

If I remove every bit of markup from my email template, and literally only have <p>Hello World</p> I get an email.

I am able to click the "Download Receipt" link, and everything works great.

When I output the option variable: {{ option }}: When I click on the "Download" link, I see receipt.

I am using the default template that ships with commerce, with the addition of a jpg header image. At the bottom of the template is this:

{% endset %}

{# Use the option param passed into the pdf template to show different 
   order pdf's depending on the context #}

 {% switch option %}
 {% case "receipt" %}
    <h1>Receipt for Order #{{ order.number[:7] }}</h1>
    {{ orderTable }}
{% case "ajax" %}
{% default %}
    {{ orderTable }}
{% endswitch %}

So clearly it has something to do with option not getting set. I'm not sure where I might have un-done setting that variable.

Any suggestions are greatly appreciated!

1 Answer 1


The option variable is only available in the pdf template, it is not available in the email template.

order variable available in both.

  • Ok it's got to be a variable I've added somewhere else. Thanks Luke!
    – Damon
    Commented Apr 11, 2017 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.