<p>Since the templates are rendered on the server and not in a regular http request (in the front end templates), the globals are not loaded automatically, into the global twig namespace. </p>

<p>You can still access your global set and use it as you usually would by setting it to a variable. You can do so like this:</p>

<p><code>{% set companyInfo = craft.globals.getSetByHandle('companyInfo') %}</code></p>

<p>You can then do:</p>

<p><code>{{ companyInfo.fieldNameHere }}</code></p>

CC BY-SA 3.0
2017-01-04T11:36:47.847Z
Brilliant. Thanks Luke. I knew it would be something as simple as this. Just wasn't sure how/what. Thanks for clarifying.
Terry Upton
CC BY-SA 3.0
2017-01-04T11:34:01.917Z
2017-01-04T12:19:18.957Z
2017-01-04T12:19:18.957Z
Luke Holder
<p>I have created a PDF template for orders and this works fine on the front-end. However, when I click to Download  PDF through the admin panel in an order. I get an error that:
<code>Variable "companyInfo" does not exist</code></p>

<p>companyInfo is a global field - I am using it to populate the company invoice details like so;
<code>{{ companyInfo.companyName }}</code> (there are several of these).</p>

<p>Any ideas why this is an issue on the back-end and not the front-end and how to resolve?</p>

<plugin-craftcommerce><globals><order><pdf>
Order PDF in back-end error with Globals
# Order PDF in back-end error with Globals

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

I have created a PDF template for orders and this works fine on the front-end. However, when I click to Download PDF through the admin panel in an order. I get an error that:
`Variable "companyInfo" does not exist`

companyInfo is a global field - I am using it to populate the company invoice details like so;
`{{ companyInfo.companyName }}` (there are several of these).

Any ideas why this is an issue on the back-end and not the front-end and how to resolve?

**Tags:** plugin-craftcommerce, globals, order, pdf


---

## 1 answers

### Answer by username_1 on 2017-01-04. Score: 4 | Accepted answer

Since the templates are rendered on the server and not in a regular http request (in the front end templates), the globals are not loaded automatically, into the global twig namespace.

You can still access your global set and use it as you usually would by setting it to a variable. You can do so like this:

`{% set companyInfo = craft.globals.getSetByHandle('companyInfo') %}`

You can then do:

`{{ companyInfo.fieldNameHere }}`

> **Comments:**
> **username_0**: Brilliant. Thanks Luke. I knew it would be something as simple as this. Just wasn't sure how/what. Thanks for clarifying.  

---

