> ## Documentation Index
> Fetch the complete documentation index at: https://docs.laravelshopper.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Customers

> In e-commerce stores, customers are one if not the fundamental point for the functioning of your store.

<Warning>
  This is documentation for Shopper v1, which is no longer maintained. Please refer to the [v2 docs](/v2) for the latest information.
</Warning>

The first page under the "Customers" menu gives you a list of all the registered users on your shop.

<Frame caption="Customers">
  <img src="https://mintcdn.com/shopperlabs-ee054f5e/jlpf_1VxeBnlQtP6/images/v1/customers.png?fit=max&auto=format&n=jlpf_1VxeBnlQtP6&q=85&s=6bf27fc289f04fa71cadf8eafdc0dc54" alt="Customers" width="1237" height="488" data-path="images/v1/customers.png" />
</Frame>

During the [installation](/installing#update-existing-files) of Shopper, one of the first things required is to inherit to our model User the features of the model User that is in Shopper.

## Fields

The model used is `App\Models\User` which extends the `\Shopper\Framework\Models\User\User` model.

<Warning>
  During the installation of Shopper, the `name` column of the users table is removed and replaced by 2 new fields which are `first_name` and `last_name`.
</Warning>

| Name                | Type      | Required | Notes                                                  |
| ------------------- | --------- | -------- | ------------------------------------------------------ |
| `id`                | autoinc   |          | auto                                                   |
| `first_name`        | string    | no       | Nullable                                               |
| `last_name`         | string    | yes      |                                                        |
| `email`             | string    | yes      | Unique                                                 |
| `password`          | string    | no       | Nullable                                               |
| `email_verified_at` | timestamp | no       | Nullable                                               |
| `gender`            | enum      | yes      | values `['male', 'female']`                            |
| `phone_number`      | string    | no       | Nullable                                               |
| `birth_date`        | date      | no       | Nullable                                               |
| `avatar_type`       | string    | no       | default [ui-avatars](https://ui-avatars.com/)          |
| `avatar_location`   | string    | no       | Nullable, picture filename                             |
| `timezone`          | string    | no       | Nullable                                               |
| `opt_in`            | boolean   | no       | default `false`, this field is for mailing subcription |
| `last_login_at`     | timestamp | no       | Nullable                                               |
| `last_login_ip`     | string    | no       | Nullable                                               |

## Components

The components used to manage customers are found in the component configuration file `config/shopper/components.php`.

```php theme={null}
use Shopper\Framework\Http\Livewire;

return [

  'livewire' => [
      'modals.delete-customer' => Livewire\Modals\DeleteCustomer::class,

      'customers.addresses' => Livewire\Customers\Addresses::class,
      'customers.browse' => Livewire\Customers\Browse::class,
      'customers.create' => Livewire\Customers\Create::class,
      'customers.orders' => Livewire\Customers\Orders::class,
      'customers.profile' => Livewire\Customers\Profile::class,
      'customers.show' => Livewire\Customers\Show::class,

      'tables.customers-table' => Livewire\Tables\CustomersTable::class,
  ];

];
```

## Manage Customers

When a new customer places an order with your store, their name and information are automatically added to your customer list. A customer profile is created when a customer interacts with your store.

Alternatively, you can add a customer to your store manually.

### Create customer

From your Shopper admin, go to Customers and click on "Add customer" button.

<Frame caption="Create customer">
  <img src="https://mintcdn.com/shopperlabs-ee054f5e/jlpf_1VxeBnlQtP6/images/v1/create-customer.png?fit=max&auto=format&n=jlpf_1VxeBnlQtP6&q=85&s=f635d0732cc0c826411d031625bc9b5f" alt="Create customer" width="1235" height="663" data-path="images/v1/create-customer.png" />
</Frame>

When creating a customer manually, you should also fill in an address that will be used when he places an order in your store.

<Frame caption="Customer address form">
  <img src="https://mintcdn.com/shopperlabs-ee054f5e/jlpf_1VxeBnlQtP6/images/v1/customer-address.png?fit=max&auto=format&n=jlpf_1VxeBnlQtP6&q=85&s=98536d9e130b0ef9a19f473328ff7d4b" alt="customer address form" width="1225" height="661" data-path="images/v1/customer-address.png" />
</Frame>

*Optional*: If the customer has agreed to receive marketing emails, and you have entered an email address, then in the Customer overview section, check Customer agreed to receive marketing emails.

And you can also check the **Send customer credentials** checkbox to sent an email to the customer with their login information.

<Frame caption="Customer notifications">
  <img src="https://mintcdn.com/shopperlabs-ee054f5e/jlpf_1VxeBnlQtP6/images/v1/customer-notification.png?fit=max&auto=format&n=jlpf_1VxeBnlQtP6&q=85&s=e0c66bb024f2f9f585eb6c828e300cf9" alt="customer notification" width="1207" height="218" data-path="images/v1/customer-notification.png" />
</Frame>

The Livewire component used to create a client is `Shopper\Framework\Http\Livewire\Customers\Create`

```php theme={null}
$customer = (new UserRepository())->create([
  'last_name' => $this->last_name,
  'first_name' => $this->first_name,
  'email' => $this->email,
  'password' => Hash::make($this->password),
  'phone_number' => $this->phone_number,
  'email_verified_at' => now()->toDateTimeString(),
  'opt_in' => $this->opt_in,
]);

$customer->assignRole(config('shopper.system.users.default_role'));
```

<Info>
  The clients that are displayed in the listing page are those that have the `user` profile which is the default role associated with all clients.
</Info>

### Customer's Information

In the case where you would like to have more information on a given customer, you can click on the customer name row in the customer's list. A new page appears.

<Frame caption="Customer informations">
  <img src="https://mintcdn.com/shopperlabs-ee054f5e/jlpf_1VxeBnlQtP6/images/v1/customer-informations.png?fit=max&auto=format&n=jlpf_1VxeBnlQtP6&q=85&s=e9728dade7b9f273ba319a4b0e248f25" alt="customer informations" width="1231" height="875" data-path="images/v1/customer-informations.png" />
</Frame>

And in this page you can modify the information of a customer by clicking on the "update" button on the right of each information.

The various sections provide you with some key data on the user:

* **Customer information**, first and last name, e-mail address, picture, birth date, gender.
* Registered **Addresses**
* **Orders** Summary of purchases already made by the customer. Amount spent, payment type, order status. For more information on each order, click on the order number.

<Tip>
  Each of its pages are accessible via Livewire components, and are fully customizable to your needs. So don't hesitate to modify them.
</Tip>
