Table of Contents | ||
---|---|---|
|
Default customer form
Default fields
By default, when the catalogue is activated, a standard form is proposed with the following fields:
Default field | Type | Mandatory | Default Validation | |||||||
---|---|---|---|---|---|---|---|---|---|---|
Last Name | text | Yes | No | |||||||
First Name | text | Yes | No | |||||||
Yes | Yes
| |||||||||
Phone Number | tel | Yes | Yes
| |||||||
Country | list | Yes | Yes
| |||||||
Address 1 | text | Yes | No | |||||||
Address 2 | text | No | No | |||||||
City | text | Yes | No | |||||||
Postal code | text | Yes | No |
This is what the default customer form looks like:
Specific configurations on the default form
Invert the position of the first and last names: so that the first name appears first and the last name second, you need to add the configuration
"customer.invert_names" : true
in the Configuration > Store App > Pages > Catalog > Specific settings page in the Options section.Code Block { "customer": { "invert_names": true } }
Change the list of countries:
The default form proposes the following countries: France, Belgium, Germany, Italy, Luxembourg, Spain, Switzerland, United Kingdom. An override can be made per sales channel using the configuration "countries.{sales_channel}.{list of countries}"
in the Configuration > Store App > Pages > Catalog > Specific settings page in the Options section.
Country codes must be in ISO-3166 format. Logos and translations will add themselves in the Store App.
Code Block |
---|
{
"countries": {
"sc_ois_1": [
"FR",
"CH"
"GB"
]
}
} |
Address autocomplete
To streamline address entry and ensure accuracy, you can activate the autocomplete module. Powered by Google, this feature provides instant address suggestions as you type, helping to automatically populate fields such as street name
...
, number, city, and postal code. Address suggestions are limited to the country selected above.
Please note:
This feature requires the activation of an additional module. To activate it, a specific contractual agreement is required, involving an additional cost per order placed through Order In Store.
For more information, please reach out to our sales team or your account manager.
Add custom fields
You can take personnalisation a step further by adding custom fields to the customer form. To do this, add the required fields to the configuration customer.custom_fields.{sales_channel}[{custom_fields_structure}]
in the Configuration > Store App > Pages > Catalog > Specific settings page in the Options section.
If the fields added are to be applied to all the project's sales channels, then the field "_ALL_"
must be given in the {sales_channel}
part.
Here is a configuration applied to all the sales channels with ...
being the structure of the custom fields that we will see below.
Code Block | ||
---|---|---|
| ||
{
"customer": {
"custom_fields": {
"_ALL_": [
{
...
}
]
}
}
} |
Custom fields structure
Inside the {sales_channel}
entity ( or "_ALL_"
) there is an array of objects. Each object corresponds to a custom field to be added to the form. Here is the configuration to be entered for each custom field.
Field | Type | Mandatory | Description | |||||||
---|---|---|---|---|---|---|---|---|---|---|
| string | Yes | This key is used to give the identifier of the field. This id must match with parameters used in
| |||||||
| string | No | Indicates whether the field should be saved in the Only used for
| |||||||
| string | No | Type of the field. By default, the
| |||||||
| boolean | No | Indicates whether the field is mandatory or not. By default, custom fields are optional. | |||||||
| string | No | This key defines the name of the form element to which it must be placed after. Please note, the form element must be in the default form or declared before in the same form. It it also possible to place the element on the top of the form with the value If not defined, the element form will be placed at the bottom of the form.
| |||||||
| object |
...
No | Enables to add custom validation to the field, which will be checked when the create button is clicked.
|
...
|
...
Fields if the field is a list
...
options
...
initial_value
...
multiple
...
searchable
Request entries
Regarding the address:
...
address_1
- sent in the customer.addresses.[0].lines.[0]
field of the POST /customers
query
...
address_2
- sent in the customer.addresses.[0].lines.[1]
field of the POST /customers
query
...
city
- sent in the customer.addresses.[0].city
field of the POST /customers
query
...
zip_code
- sent in the customer.addresses.[0].zip_code
field of the POST /customers
query
...
|
In case of lists
If the type of field added is a list, then additional configurations must be added inside the structure.
Field | Type | Mandatory | Description | |||||||
---|---|---|---|---|---|---|---|---|---|---|
| array[string] | Yes | List of values displayed in the drop down. Options inside will be translated with the key
| |||||||
| bool | No | Indicates if multiple selection can be done. | |||||||
| bool | No | Indicates if drop down elements are searchable. | |||||||
| string | No | Indicates the pre-selected option. |
Examples
Expand | ||
---|---|---|
| ||
|
Expand | ||
---|---|---|
| ||
|
Expand | ||
---|---|---|
| ||
|
Edit default fields parameters
The form's default fields cannot be deleted, but they can be modified. To do this, just configure these fields in the same configuration as custom fields using the same configuration structure. It is essential that the field name
configured corresponds to the name of the default fields given above.
Note |
---|
Overloading a default field removes its mandatory and validation options. To make it mandatory again, for example, specify |
Examples
Expand | ||
---|---|---|
| ||
|
Expand | ||
---|---|---|
| ||
|
Expand | ||
---|---|---|
| ||
|
Customer creation request
Once the customer form has been completed and validated, a call will be made to the POST/customers route. If an external CRM has been configured, the call will be directly made to this external CRM.
Expand | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
|
...
|
...
title
...
first_name
...
last_name
|
...
email
...
company_name
|
Regarding custom information
...
|
...
|
...
|
...
Please note, the label of the field will be translated based on the translation key crm.<name>
.
...
Key
...
Mandatory
...
Type
...
Allowed values
...
Default value
...
Description
...
target
...
No
...
string
...
customer
address
...
customer
...
This key defines which form is targetted: customer
or address
. By default if target
is not given, customer
is applied.
Only useful for information.{custom_field}
and external_id
fields
...
type
...
No
...
string
...
text, email, tel, password, flip-switch, list
...
text
...
This key defines the HTML element is used.
text
is for HTML input type text. Value returned will be a stringemail
is for HTML input type email. Value returned will be a stringtel
is for HTML input type tel. Value returned will be a stringpassword
is for HTML input type password. Value returned will be a stringflip-switch
is for toggle switch (yes/no). Value returned will be booleantrue
for YES, andfalse
for NOlist
is for drop-down. If keymultiple:false
, then value returned will be a string. If keymultiple:true
, then value returned will be an array of string
...
options
...
No
...
string[]
...
/
...
/
...
This key is usable only if key:list
It defines values inside dropdown.
Content inside will be translated based on translation keys crm.information._<list_name>_options.<option_value>
where <list_name>
is the name of the list that will use options, and <option_value>
is the value of the option.
...
initial_value
...
No
...
string / bool
...
/
...
/
...
This key is usable ONLY if key:list
It defines which value will be preselected.
If multiple:true, use comma ',' to separate values.
...
multiple
...
No
...
bool
...
/
...
false
...
This key is usable ONLY if key type:list
.
It defines if multiple selection can be done.
If key multiple:false,
then value returned will be a string. If key multiple:true
, then value returned will be an array of string.
...
searchable
...
No
...
bool
...
/
...
false
...
This key is usable only if key type:list
It defines if dropdown elements are searchable.
...
required
...
No
...
bool
...
/
...
false
...
This key force completion to validate form.true
to force.
...
position_after
...
No
...
string
...
/
...
/
This key defines the name of the form element to which it must be placed after. ":first"
is a keyword to place the element on the top of the form.
If multiple elements are with position_after::first
, they will be placed on the top of the form in the order of their declaration (first declared will be on the top).
Element which is named in this key MUST have been declared before in the same form as this one.
...
|
An external CRM may generate errors (e.g., email address or phone number already existing in the database).
In such cases, the external CRM must return a 409
error containing:
field
- form field in errormessage
- error message to display
Then, the error message will be display on the form.