Magento 2 Extensions:Order And Customer Attributes

From XTENTO Support Wiki
Jump to: navigation, search
This is a guide for Magento 2. This extension is a Magento 2 only extension, we don't offer a version for Magento 1 at this point.




Collecting additional order and customer information has never been easier. Easily add as many fields as required to the Magento checkout and store them against the order, customer or customer address. Display collected information in the Magento backend and the orders grid. Supports various field types (text field, area, checkbox, select, date, ...) and is fully integrated for interaction with the Magento 2 API.

Interested in this Magento Extension?

Head over to our store to purchase this extension: Order & Customer Attributes (Magento 2)

Got questions? Feel free to contact us! Contact Form

Setting up the extension

The extensions configuration section is located at System > XTENTO > Custom Attributes. Make sure to enable the extension there.

Using the extension

Go to Stores > Manage Order/Customer Attributes to manage your custom attributes. This is the main configuration of the extension.

Use the "Add" button to add a new attribute to Magento. You can select from three options:

After selecting an attribute type, you will be presented with the attribute configuration:

Attribute Settings

 Option / Setting  Description
Default Label Label shown in checkout/admin. Translate in "Labels" tab.
Attribute Type Order/Customer/Customer Attribute. Cannot be changed for an attribute after attribute creation.
Field Type Frontend/backend input type for the attribute. Possible values: Text Field, Text Area, Date, Date & Time, Yes/No, Multiple Select, Dropdown, Radio Buttons, Checkboxes, File Upload. Cannot be changed for an attribute after attribute creation.
Enabled Yes/No. If disabled, won't show up in the backend and frontend.
Attribute Code This is the internal identifier for the attribute. It is the column name in the database, and used when updating the attribute via the API for example. Make sure you don't use spaces or more than 30 symbols. Use lowercase names only, and replace spaces with the _ character. Example: my_custom_attribute
Default Value Pre-populate the input field with a default value

Display Settings

 Option / Setting  Description
Visible in Backend If enabled, the attribute will be shown when viewing an order/customer
Show in admin grids If enabled, you can show this field in the Sales > Orders grid
Show on PDF If enabled, the attribute will be shown on PDF printouts
Checkout Field Position If required you can specify a sort order to manage sorting of custom attributes in the Magento checkout
Visible on Frontend Specify where in the frontend this attribute should be visible. You can also hide it from the frontend entirely.
Customer Groups Specify if only certain customer groups are allowed to see the attribute in the frontend
Checkout Tooltip Add a tooltip/help text that is shown when hovered over the attribute in the checkout
Checkout Location Specify where the attribute is shown in the Magento checkout. Possible values: Billing Address, Shipping Address, Both Addresses, Above shipping address, Above shipping methods, Above place order, Above payment methods, Below payment methods
Required If set to "Yes", the customer will need to enter a value whenever he encounters this attribute, be it in the checkout or when editing his account.

Store Views
Specify store views in which this attribute should be displayed.

Labels / Translation
Easily translate the attribute label for each of your store views.

After configuring your attribute, click the "Save" button to create the attribute. You can now use it everywhere in Magento, via the API and in the Magento checkout.


How do I access the attributes via the Magento 2 API?

Custom attributes created using this extension are fully integrated into the Magento 2 API. You can see them on order, customer or customer address level, depending on the attribute type you have created. You can also access them directly in the Magento database, they are proper attributes added to the "sales_order" table (and "customer" tables for customer attributes).

Updating values of order attributes for existing orders via the API

Since module version 1.5.8, a webapi method exists that allows you to update existing orders and update the values of custom attributes. Sample code: (Read code carefully. Adjust URL to your Magento instance, webapi admin username/password, ...)

Customer attributes empty in orders grid

Customer attributes show the state/the value saved for the customer at the time the order was placed. So if you edit the customer now, it won't be reflected for old orders on the orders grid. It applies for new orders only, or if entered in the checkout, you'll see the "new" value in the "new" order too.

Getting customer attribute values programmatically

Right now it does not seem to be possible to get values of custom customer attributes via the CustomerRepositoryInterface. Instead, load the Customer via the \Magento\Customer\Model\Customer model instead and you will be able to retrieve your custom attribute values using $customer->getWhateverCustomAttribute().

Cannot read property 'quoteData' of undefined

This probably means you have another order/customer attributes extension in Magento installed, for example MagePlaza Customer Attributes. It does not make sense to have two custom attribute extensions installed in one Magento instance, and this will lead to problems. Remove other order/customer attribute extensions.

Cannot change the attribute type, the dropdown field is inactive

Please use the right arrow on the "Add Attribute" button to select the attribute type, either an order attribute, customer attribute or the customer address.

Personal tools
General Information
Magento 2 Guides
Magento 2 Extensions
Magento 1 Guides
Magento 1 Extensions
Magento Integration Suite
Product Feed Guides