Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-20T11:43:13.273Z
Answers.Text: 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.
Answers.UserDisplayName: artmem
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-20T14:41:57.703Z
Answers.Text: 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.
Answers.UserDisplayName: artmem
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-20T05:41:34.927Z
Answers.LastActivityDate: 2023-03-02T04:03:13.413Z
Answers.LastEditDate: 2023-03-02T04:03:13.413Z
Answers.UserDisplayName: Luke Holder
Body: <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>
  
Tags: <plugin-craftcommerce><error-message><plugin-craftcommerce3><addresses>
Title: Commerce: Calling unknown method error on Edit Address screen
ThreadText: # 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.  
  
  ---
  
  