1

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" %}
    <h1>NA</h1>
{% default %}
    {{ orderTable }}
{% endswitch %}
</body>

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!

3

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

order variable available in both.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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