Answers.Body: <p>You shouldn't really need to do that, you're just adding custom fields to the user when those can be fetched easilly.
  A customer will always be a user, but a user might not be a customer.</p>
  
  <p>If you intend to get the customer details from a plugin (with PHP) you can just get the customer details (if exist) from the user, by using the Commerce_CustomersService</p>
  
  <p>code example would be</p>
  
  <pre><code>$customer = craft()-&gt;commerce_customers-&gt;getCustomerByUserId($user-&gt;id);
  </code></pre>
  
  <p>this will either return the customer model or null (if a customer is not created against the user).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-06T00:09:07.177Z
Answers.Text: That is definitely the correct answer!  Thanks!  Have you had success programmatically creating orders in Commerce 1 in the past?
Answers.UserDisplayName: biko
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-05T10:11:58.907Z
Answers.LastActivityDate: 2019-02-05T10:11:58.907Z
Answers.UserDisplayName: RoussKS
Answers.Body: <p>Figured it out.  For anyone else looking for this info, the answer is:</p>
  
  <p>Create a field of type Customer Customer Info.  Add it as a field in the User Field Settings.</p>
  
  <p>Access it using the handle you assigned it.</p>
  
  <p>E.g.</p>
  
  <pre><code>$customer = $user-&gt;customerInfo;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-06T00:10:00.060Z
Answers.Text: Marked RoussKS as the right answer.
Answers.UserDisplayName: biko
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-05T06:44:54.870Z
Answers.LastActivityDate: 2019-02-05T06:44:54.870Z
Answers.UserDisplayName: biko
Body: <p>In PHP, is it possible to grab the customer model from a user model?</p>
  
  <p>EDIT:
  I just noticed that it is possible to attach a customer info field to the user.  How do we achieve this?</p>
  
Tags: <plugin-development><plugin-craftcommerce><users>
Title: Commerce 1 get customer from user model
ThreadText: # Commerce 1 get customer from user model
  
  (Asked by: username_0 on 2019-02-05)
  
  In PHP, is it possible to grab the customer model from a user model?
  
  EDIT:
  I just noticed that it is possible to attach a customer info field to the user. How do we achieve this?
  
  **Tags:** plugin-development, plugin-craftcommerce, users
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-02-05. Score: 2 | Accepted answer
  
  You shouldn't really need to do that, you're just adding custom fields to the user when those can be fetched easilly.
  A customer will always be a user, but a user might not be a customer.
  
  If you intend to get the customer details from a plugin (with PHP) you can just get the customer details (if exist) from the user, by using the Commerce\_CustomersService
  
  code example would be
  
  ```
  $customer = craft()->commerce_customers->getCustomerByUserId($user->id);
  
  ```
  
  this will either return the customer model or null (if a customer is not created against the user).
  
  > **Comments:**
  > **username_0**: That is definitely the correct answer!  Thanks!  Have you had success programmatically creating orders in Commerce 1 in the past?  
  
  ---
  
  ### Answer by username_0 on 2019-02-05. Score: 0
  
  Figured it out. For anyone else looking for this info, the answer is:
  
  Create a field of type Customer Customer Info. Add it as a field in the User Field Settings.
  
  Access it using the handle you assigned it.
  
  E.g.
  
  ```
  $customer = $user->customerInfo;
  
  ```
  
  > **Comments:**
  > **username_0**: Marked username_1 as the right answer.  
  
  ---
  
  