Page::Departments / NAVcommerce / Attributes / Customer Attributes
Customer Attributes can be used to send additional customer information from NAV to Magento. This means that, after you have defined a new attribute, each time a customer record gets synced with Magento, this piece of information is updated on the Magento side as well.
The NAVcommerce customer attributes system relies on the standard Magento attributes mechanism. This feature allows users / developers to add custom attributes to just about anything within Magento.
To create a new attribute you have to do 2 things.
Step 1. Create the attribute on the NAV side.
Step 2. Create the same attribute on the Magento side.
With Magento Commerce edition this can be done via the backend: https://docs.magento.com/m2/ee/user_guide/stores/attributes-customer.html
With Magento Open Source edition this can be done via code: https://www.mageplaza.com/magento-2-module-development/magento-2-add-customer-attribute-programmatically.html
By default NAVcommerce has already implemented the following list of customer attributes:
|NAV Customer Field||Magento Custom Attribute Code|
|Customer Price Group||nav_customer_price_group|
|Customer Disc. Group||nav_customer_discount_group|
|Payment Terms Code||nav_payment_terms_code|
|Payment Method Code||nav_payment_method_code|
On the Magento side, the standard NAVcommerce Magento Configuration extension creates the corresponding Magento attributes as part of the extension installer procedure.
See “\app\code\NavCommerce\Configuration\Setup\UpgradeData.php” for more information.
If you want to access custom attributes in code you can use the following statement.