In some cases, it could be that we need extra attributes for a customer like we did for products. Because a customer is an EAV object, it is possible to add attributes to it, but there is no interface for that in the Community Edition of Magento. When we want to do that, we need to install the attributes by code, and that's the thing that we will do in this recipe. We will add a new field loyaltynumber
to the customer.
To add a customer attribute, we need to create an installation or upgrade script. In this recipe, we will create a new module that will install the attribute with the installation script so we don't need to install starter files in Magento.