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?
Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. It only takes a minute to sign up.Sign up to join this community
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).