Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [customer-attribute]

Creating, managing and using Customer entity attributes

Filter by
Sorted by
Tagged with
22 votes
5 answers
36k views

Magento 2: How to create a customer custom attribute? [duplicate]

What are steps to create a custom attribute for Customer entity in Magento 2?
huzefam's user avatar
  • 2,606
14 votes
4 answers
17k views

Magento 2 custom customer attribute's values not getting saved in database?

I've added two custom attributes for customer registration page (Alternate email & Alternate number) in a new module (through : app/code/.../Setup/InstallData.php). I have designed its 'view' ...
Kartik's user avatar
  • 395
13 votes
7 answers
12k views

What's the difference between an user defined attribute and non user defined attribute?

I have an customer attribute defined as follows: $customerSetup->addAttribute(Customer::ENTITY, "attr_code", [ "type" => "varchar", "backend" => "", ...
PY Yick's user avatar
  • 2,705
12 votes
4 answers
21k views

How can we remove/delete the custom attribute(created for customer) in Magento 2

I want to remove the custom attribute created for customer using installchema,I followed this link but it didn't helped.Anyone tried earlier,please help.Thanks in advance! I have added attribute ...
Bibhu Asish's user avatar
11 votes
1 answer
2k views

Customer Attribute not showing in adminhtml customer account form in Magento Enterprise 2.2.0

I have created module "Wgac_Subscription". I want to create custom customer attribute. It is listed in admin as shown in below image, but does not show in customer adminhtml form. Wgac/Subscription/...
Shashank Kumrawat's user avatar
10 votes
2 answers
4k views

What does the Customer is_active flag do?

During a discussion today I was informed that the Customer is_active flag doesn't actually do anything. This is a unique flag, like the customer email address, in that it's not an EAV attribute. ...
Ryre's user avatar
  • 1,147
9 votes
5 answers
32k views

Get Customer information from order Magento 2

I want to retrieve customer information from sales order view observer in adminhtml section, currently i only know how to retrieve order in that observer like this: namespace Namespace\Module\Block\...
Idham Choudry's user avatar
9 votes
4 answers
12k views

Magento 2.3 - Customer address attribute not saving in checkout from

I have created a custom custom_address attribute "a_mobile_phone". I can save the attribute in the admin and the customer address edit form. I have added this attribute to the checkout address form ...
Taschert's user avatar
  • 569
9 votes
2 answers
12k views

How to create multi select attribute for customer using install script?

I'm following many articles but i'm not able create multi select attribute. and i'm getting following error. a:5:{i:0;s:50:"Source model "" not found for attribute "exinent1"";i:1;s:3008:"#0 C:\...
sivakumar's user avatar
  • 287
8 votes
1 answer
5k views

Add a custom attribute in grid customer magento 2

I have created an attribute type: select but i can't display it in the grid customer. the code of my customer_listing.xml <column name="customer_status"> <argument name="data" xsi:...
Developper Magento 's user avatar
8 votes
6 answers
53k views

Magento2: get custom customer attribute value

I've create a customer attribute using following installer data, InstallData.php file <?php namespace Amitshree\Marketplace\Setup; use Magento\Eav\Setup\EavSetup; use Magento\Eav\Setup\...
amitshree's user avatar
  • 7,036
7 votes
3 answers
52k views

Get attribute value in product view page

I want to to display attribute value in Product view page. link I'm trying following code : echo $_attribute->getProductAttribute()->getAttributeCode(); or $_attribute_code = Mage::getModel('...
Baby in Magento's user avatar
7 votes
6 answers
31k views

Magento 2: Save custom customer attribute value programmatically

How can I save a custom Customer Attribute value programmatically? I have tried below code but it didn't work. protected $customer; public function __construct( \Magento\Customer\Model\Customer $...
Dinesh Yadav's user avatar
  • 6,457
7 votes
2 answers
12k views

Magento2 : user define customer attribute not save value while create / save from admin

I have created two customer attribute one "abc" and second is "xyz" this two attribute display properly in customer admin. also attributes are created in database table "eav_attribute". But while save ...
Sarfaraj Sipai's user avatar
7 votes
4 answers
3k views

How to add a unique custom attribute for a customer?

I was able to add a custom attribute called 'Username' to the Magento Customer model. The install-function in InstallData.php looks like this: public function install(ModuleDataSetupInterface $setup,...
Michiel Vandendriessche's user avatar
7 votes
2 answers
7k views

Magento2 : How I can add Date of Birth field to customer address

As per Magento default "Date of birthday" is display in customer registration form. I want to show it on customer address form in checkout step. Any way to display it on customer address form. I don'...
Suresh Chikani's user avatar
7 votes
2 answers
7k views

Customer address attribute value is not saving in Magento 2

We are working on trying to create customer address attribute as input type is File, we have downloaded the code from silksoftware by selecting "Need to Add Customer Attribute" -> "Entity Type" -> "...
Krishna ijjada's user avatar
7 votes
0 answers
934 views

How to pass a attribute code dynamically in extension_attributes.xml

How to pass a attribute code dynamically in extension_attributes.xml or how to save a custom field value in db in checkout page without extension_attributes extension_attributes.xml <?xml ...
Divya Sekar's user avatar
  • 1,485
6 votes
2 answers
9k views

Customer custom attribute not showing in admin form

I successfully add customer custom attribute for magento 2.2.5 like this: $setup->startSetup(); $insertArray = array( 'profile_picture' => array("type" => "varchar", "label" =&...
Tiny Dancer's user avatar
6 votes
1 answer
9k views

Magento 2 : How to know "used_in_forms" param of eav attribute for a form?

I was wondering if there is a full proof method for finding all used_in_forms params of eav attribute which is specified in InstallData.php to create all kind of attributes for a form or maybe ...
Vivek Kumar's user avatar
  • 5,655
6 votes
4 answers
5k views

Update customer gender translations

I would like to translate the gender options for a customer. At first I thought that I could simply use a translation file for this, but looking into the template app/design/frontend/base/default/...
David Manners's user avatar
6 votes
2 answers
9k views

Retrieve all customers data

I want to retrieve all customer data including the address information, customer custom attributes, and customer profile information. Right now i'm using customer model like this: $collections = Mage:...
Shell Suite's user avatar
  • 1,702
6 votes
2 answers
9k views

How can I add customer attribute in Magento 2?

Note: The question was referring to magento2-dev-beta and the code for setup scripts is not the same anymore in Magento 2.x. I'm playing with Magento 2 and I'm stuck in adding attribute for customer ...
Wojtek Naruniec's user avatar
6 votes
1 answer
3k views

Add option for custom select attribute on customer edit page Magento 2

I want to add my own custom option for an attribute.Please see attached image. Just guide me which files i need to create. I have just created one file for now. Please see code below, app/code/...
Sunny Rahevar's user avatar
5 votes
2 answers
5k views

How to add dropdown attribute to custom module in magento 2.0

I wanted to add dropdown attribute called 'customer type' with drop down options 'buyer' and 'seller' to my custom module. How can I make it to my upgrade schema?
sagar sapkota's user avatar
5 votes
3 answers
12k views

Source Model not found for Attribute

Edit: For anyone who may also have this problem, make sure that your spelling is correct, but also that your capitalization is correct. And remember that magento cannot read model files that have any ...
The_DemoCorgin's user avatar
5 votes
2 answers
2k views

Magento 2 : Unable to set custom customer attributes programmatically

I have a cron job that runs once a day, that reads a file uploaded to the server, and registers users from that file. The code works fine, but now I added a custom attribute to the customer (lets call ...
Bawsi's user avatar
  • 193
5 votes
2 answers
3k views

What the meaning of <fieldsets> in config.xml [duplicate]

Here is my code. <global> <fieldsets> <customer_account> <customeattribute> <create>1</create> <update>1</...
Praful Rajput's user avatar
5 votes
1 answer
7k views

how to get customer id by custom attribute value

I need to get customer id before login by custom attribute value in Magento 2.1.5, for login by username. $this->customerRepository->get($username);
Birjitsinh Zala's user avatar
5 votes
2 answers
9k views

Add Field to Customer Registation Form Magento 2

I want to add a field/attribute to Customer Registration Form on frontend. And I create a folder in my module , the folder is "Setup" and I put inside a file "InstallData.php" but this doesn't work. ...
Riccardo Amadio's user avatar
5 votes
1 answer
1k views

Set attribute for customer registration form on frontend

I use this code to set the "promotion code " attribute but in some way this attribute is aviable only from admin panel. This is the code : <?php namespace Riccardo\Plugin\Setup; use Magento\...
Riccardo Amadio's user avatar
5 votes
1 answer
382 views

Magento 2 : How to upload file using Rest Api

I want to upload file using REST Api. As per my reserch there are two ways for this. by passing base64 encoded string into form-data by passing file upload parameter into form-data But I am confused ...
Krupa Popat's user avatar
5 votes
1 answer
1k views

Magento2 Add legends between fields on customer form adminhtml (customer attributes)

I photoshoped what I want: I create a repo for that extension, so you can see all the code: https://github.com/slayerbleast/CustomerAttributes What I did: I added some customerAttributes: ...
Marc Pont's user avatar
  • 1,453
4 votes
3 answers
8k views

Magento 2.3 - How to add custom column to customer_entity table

I'm creating a Referral Program module, and I want to create a custom column inside the customer_entity table. The column is referred_by and it's a foreign key that as a relation with the ...
Mirko Rapisarda's user avatar
4 votes
3 answers
13k views

Magento 2: How to get first and last name of customer?

I have a customer ID and I want to get first name and last name of that customer. Any solution?
umair ayub's user avatar
  • 1,073
4 votes
8 answers
4k views

“Type Error occurred when creating object: Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Config”

I have migrated from ver 1.9 to 2.3
Kapil Dev Singh's user avatar
4 votes
1 answer
5k views

Create customer custom attribute with input type checkbox, multiselect, and radio Magento 2

I successfully created custom attribute for customer with input type select/dropdown like this: $code = 'test'; $customerSetup = $this->customerSetupFactory->create(); $customerSetup->...
Idham Choudry's user avatar
4 votes
2 answers
3k views

Attribute with the same code already exists when add Custom Customer Attribute from Controller

i try following this tutorial to add new customer attribute, the tutorial run the function at InstallData.php. I'm trying to run the function from controller and i got the following error: "Attribute ...
Hunter's user avatar
  • 1,484
4 votes
1 answer
4k views

Error in creating custom customer attribute in magento 2

I need to create customer custom attribute. In module.xml <sequence> <module name="Magento_Customer"/> </sequence> in upgrade schema UpgradeSchema.php ...
chin's user avatar
  • 431
4 votes
2 answers
818 views

Magento 2.3 - Add custom customer entity attribute with service contract

I have some problem to save custom customer entity attribute in database. I've created a Patch to add this attribute to the customer entity. The attribute is shown correctly in the backend, but when I ...
Mirko Rapisarda's user avatar
4 votes
2 answers
195 views

What is the difference between the customer attribute properties user_defined and system and what are they used for?

How to create a customer attribute is explained in various answers such as this or this. What they all have in common, is that when creating the attribute its properties user_defined and system are ...
Daniel's user avatar
  • 2,229
4 votes
2 answers
3k views

Magento 2: How to add date of birth and gender fields in checkout

I enabled Gender and Date of Birth from Customer Configuration in back-end. Those fields are showing in registration page but I also want to add those fields in checkout page too where customer enters ...
Kishan Patadia's user avatar
4 votes
0 answers
392 views

Magento2 : How to add row/pattern type of customer attribute

How to add a row/pattern type of custom customer attribute (dynamic rows). We have the below attribute in Magento 1, we need to achieve the same in Magento 2. I don't find any code reference for this,...
Bilal Usean's user avatar
4 votes
0 answers
360 views

Magento 2 Save custom customer attribute to customer addresses in checkout

There are many post on Stackexchange and blogs that explain how to add custom field to checkout forms. Some of them also explain how to save them to quote/order address. I've achieved all these ...
Daniele Rovatti's user avatar
3 votes
6 answers
16k views

How to prevent "Call to a member function getValue() on null" when using getCustomAttribute()->getValue()?

My colleague wrote some code, which is hidden behind an interface: $myCustomValue = $customer->getCustomAttribute('my_custom_attribute')->getValue(); Working on integrations now, I invoke his ...
hey's user avatar
  • 1,137
3 votes
3 answers
25k views

How to get the customer attribute value?

What I want add customer attribute show the new attribute in front(dashboard) page Problem I have created customer attribute with this code below: <?php define('MAGENTO', realpath(dirname(...
Edward's user avatar
  • 133
3 votes
3 answers
14k views

Update customer password directly in database

If I have access to my database, can I manually override a customer password? This is my local development environment. I have little knowledge of password encryption but I would like to be able to ...
rushtoni88's user avatar
3 votes
1 answer
2k views

Magento 2 Fail to save the value of a newly added Yes/No customer attribute

The customer attribute shows up but cannot save it because there are no records about this attribute in eav_entity_attribute table, when I manually add a row for the attribute, it can be saved. How to ...
Ricky.C's user avatar
  • 2,182
3 votes
3 answers
4k views

magento2 create customer attribute

Anyone Can help me, I want to add customer Attribute and i have put my code as below.I have installed it, not getting any error but noting happened. Customer/Attrib/Setup/InstallData.php <?php ...
Naim Malek's user avatar
3 votes
2 answers
3k views

Filter orders by customer email id

How I can filter Magento order by any customer email id? I'm doing something like but I'm not getting the result. $customer_email ='[email protected]'; $orders = Mage::getModel('sales/order')->...
amitshree's user avatar
  • 7,036

1
2 3 4 5
10