<p>The <code>option</code> variable is only available in the pdf template, it is not available in the email template.</p>

<p><code>order</code> variable available in both.</p>

CC BY-SA 3.0
2017-04-11T14:35:50.777Z
Ok it's got to be a variable I've added somewhere else. Thanks Luke!
Damon
CC BY-SA 3.0
2017-04-11T12:24:07.827Z
2017-04-11T12:24:07.827Z
Luke Holder
<p>I am getting this error when trying to send a confirmation email to the user.</p>

<pre><code>Template error: “Variable "option" does not exist
</code></pre>

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

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

<p>When I output the <code>option</code> variable: <code>{{ option }}</code>:
When I click on the "Download" link, I see <code>receipt</code>.</p>

<p>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:</p>

<pre><code>...
{% endset %}

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

 {% switch option %}
 {% case "receipt" %}
    &lt;h1&gt;Receipt for Order #{{ order.number[:7] }}&lt;/h1&gt;
    {{ orderTable }}
{% case "ajax" %}
    &lt;h1&gt;NA&lt;/h1&gt;
{% default %}
    {{ orderTable }}
{% endswitch %}
&lt;/body&gt;
</code></pre>

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

<p>Any suggestions are greatly appreciated!</p>

<plugin-craftcommerce>
Commerce: Template error: “Variable "option" does not exist
# Commerce: Template error: “Variable "option" does not exist

(Asked by: username_0 on 2017-04-11)

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 Hello World 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" %}
    Receipt for Order #{{ order.number[:7] }}
    {{ orderTable }}
{% case "ajax" %}
    NA
{% 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!

**Tags:** plugin-craftcommerce


---

## 1 answers

### Answer by username_1 on 2017-04-11. Score: 3 | Accepted answer

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

`order` variable available in both.

> **Comments:**
> **username_0**: Ok it's got to be a variable I've added somewhere else. Thanks Luke!  

---

