<p>You have a variable called <code>model</code> set to a matrix block (as per the error, a matrix block doesn't have a <code>firstName</code> field). The <code>model</code> needs to be an address model.</p>

CC BY-SA 4.0
2022-09-20T11:43:13.273Z
But there is no matrix block. I’m not sure why it thinks it’s a matrix and not an address model. The code is straight from the default templates.
artmem
CC BY-SA 4.0
2022-09-20T14:41:57.703Z
Figured it out. I was setting an unrelated variable called "address" that was referring to a matrix block in my layout template. That was conflicting with my `model` variable which was also set to "address". Changing the name of my original variable resolved the issue.
artmem
CC BY-SA 4.0
2022-09-20T05:41:34.927Z
2023-03-02T04:03:13.413Z
2023-03-02T04:03:13.413Z
Luke Holder
<p>I'm using Commerce 3.4.16, Craft 3.7.51.</p>
<p>I'm able to enter an address as part of checkout, and I can see that address in the CP, but when I go to the edit address screen on the front end, I get this error:</p>
<pre><code>Calling unknown method: craft\elements\MatrixBlock::firstName()
...    
in .../templates/shop/_private/address/form.twig
</code></pre>
<p>The relevant code is:</p>
<pre><code>{{ input('text', modelName ~ '[firstName]', model ? model.firstName : '', {
    id: modelName ~ '-firstName',
    class: ''
}) }}
</code></pre>
<p>I get the error in my custom template, and also when using the default templates.</p>
<p>If I take everything else out of the template, both {{ model }} and {{ modelName }} are defined, so I'm not sure what's going on.</p>

<plugin-craftcommerce><error-message><plugin-craftcommerce3><addresses>
Commerce: Calling unknown method error on Edit Address screen
# Commerce: Calling unknown method error on Edit Address screen

(Asked by: username_0 on 2022-09-19)

I'm using Commerce 3.4.16, Craft 3.7.51.
I'm able to enter an address as part of checkout, and I can see that address in the CP, but when I go to the edit address screen on the front end, I get this error:
Calling unknown method: craft\elements\MatrixBlock::firstName()
...    
in .../templates/shop/_private/address/form.twig

The relevant code is:
{{ input('text', modelName ~ '[firstName]', model ? model.firstName : '', {
    id: modelName ~ '-firstName',
    class: ''
}) }}

I get the error in my custom template, and also when using the default templates.
If I take everything else out of the template, both {{ model }} and {{ modelName }} are defined, so I'm not sure what's going on.

**Tags:** plugin-craftcommerce, error-message, plugin-craftcommerce3, addresses


---

## 1 answers

### Answer by username_1 on 2022-09-20. Score: 1

You have a variable called `model` set to a matrix block (as per the error, a matrix block doesn't have a `firstName` field). The `model` needs to be an address model.

> **Comments:**
> **username_0**: But there is no matrix block. I’m not sure why it thinks it’s a matrix and not an address model. The code is straight from the default templates.  
> **username_0**: Figured it out. I was setting an unrelated variable called "address" that was referring to a matrix block in my layout template. That was conflicting with my `model` variable which was also set to "address". Changing the name of my original variable resolved the issue.  

---

