Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customer attributes default value #39605

Open
5 tasks
sheepfy opened this issue Feb 5, 2025 · 15 comments
Open
5 tasks

Customer attributes default value #39605

sheepfy opened this issue Feb 5, 2025 · 15 comments
Labels
Adobe Commerce The issue related to the Adobe Commerce(EE) or B2B functionality Area: Account Component: CustomerAttributes Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@sheepfy
Copy link
Contributor

sheepfy commented Feb 5, 2025

Preconditions and environment

  • Magento version latest
  • Have an existing customer

Image

Image

Steps to reproduce

Create random customer attribute for customer edit page.
Login, go to check the attribute into the edit page
Notice that the default value is not there.

Expected result

The default value to be autofilled in the form (or at least loaded on the Magento\Customer\Model\Customer object at vendor/magento/module-custom-attribute-management/Block/Form/Renderer/AbstractRenderer.php :: getValue method)

Actual result

Null value comes instead of the default value

Additional information

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Copy link

m2-assistant bot commented Feb 5, 2025

Hi @sheepfy. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce.


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

@engcom-Bravo engcom-Bravo self-assigned this Feb 5, 2025
Copy link

m2-assistant bot commented Feb 5, 2025

Hi @engcom-Bravo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Bravo engcom-Bravo added the Reported on 2.4.x Indicates original Magento version for the Issue report. label Feb 5, 2025
@engcom-Bravo
Copy link
Contributor

Hi @sheepfy,

Thanks for your reporting and collaboration.

We have tried to reproduce the issue in Latest 2.4-develop instance and we are not able to reproduce the issue.Kindly refer the screenshots.

Image

Image Image

The default value was loaded in customer account information.Could you please let us know if we are missing anything.

Thanks.

@engcom-Bravo engcom-Bravo added the Issue: needs update Additional information is require, waiting for response label Feb 6, 2025
@sheepfy
Copy link
Contributor Author

sheepfy commented Feb 6, 2025

@engcom-Bravo According to your screenshots, the default value set in admin is "No" (you can also try it with yes).
The value from the dropdown in account info is "none"/ "empty".

Then in order to same the customer, you have to select a value from that dropdown, which is empty:

Image

@sheepfy
Copy link
Contributor Author

sheepfy commented Feb 6, 2025

@engcom-Bravo ah, now I see. You were checking the attribute label.
I was talking about the default value of the attribute, not the label.

@engcom-Bravo
Copy link
Contributor

HI @sheepfy,

Thanks for your update.

Image

In order to save the customer we are able to see the dropdown values.Could you please let us know if we are missing anything.

Thanks.

@sheepfy
Copy link
Contributor Author

sheepfy commented Feb 7, 2025

@engcom-Bravo The default value, which is set from admin to be "No", is not preselected.

Copy link

m2-assistant bot commented Mar 17, 2025

Hi @engcom-November. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-November
Copy link
Contributor

Hello @sheepfy,

Thank you for your report and collaboration.

We have reviewed the issue, and it is reproducible on the latest 2.4-develop instance. Please refer to the attached screenshots for reference.

Steps to Reproduce:

  • Log in to the Magneto Admin panel.
  • Navigate to Stores → Attributes → Customer.
  • Click on the Add New Attribute button.
  • Provide the same details as shown in the attached screenshots and save the attribute.
Image Image Image

The issue has been confirmed, and we will proceed with further investigation and updates.

Thank you.

@engcom-November engcom-November added Area: Account Component: CustomerAttributes Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed and removed Issue: needs update Additional information is require, waiting for response labels Mar 17, 2025
@github-jira-sync-bot github-jira-sync-bot removed the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Mar 17, 2025
@github-jira-sync-bot
Copy link

Unfortunately, not enough information was provided to create a Jira ticket. Please make sure you added the following label(s): Reproduced on 2.4.x, ^Area:.*

Once all required labels are present, please add Issue: Confirmed label again.

@engcom-November engcom-November added Adobe Commerce The issue related to the Adobe Commerce(EE) or B2B functionality Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Mar 17, 2025
@github-jira-sync-bot github-jira-sync-bot removed the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Mar 17, 2025
@github-jira-sync-bot
Copy link

Unfortunately, not enough information was provided to create a Jira ticket. Please make sure you added the following label(s): Reproduced on 2.4.x, ^Area:.*

Once all required labels are present, please add Issue: Confirmed label again.

@engcom-November engcom-November added Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Mar 17, 2025
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-14246 is successfully created for this GitHub issue.

Copy link

m2-assistant bot commented Mar 17, 2025

✅ Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@ajay2108
Copy link

@sheepfy @engcom-November - I have investigated this and confirmed that it is not an issue but rather expected Magento behavior.

When a new customer attribute is created in Magento, it works as expected for customers who are registered after the attribute is created. This is because Magento automatically assigns the default value to new customer records.

However, for existing old customers, the attribute's default value is not applied automatically. Magento does not retroactively update old customer records with the newly assigned default value. As a result, these customers will not have any entry for the attribute in the relevant database table (e.g., customer_entity_int, customer_entity_varchar, etc.).
To ensure that the default value is assigned to all previously created customers, a data patch script should be implemented. This sounds like more of feature request.However, I will looking forward what is your thought on this.

Thanks

@sheepfy
Copy link
Contributor Author

sheepfy commented Mar 20, 2025

@ajay2108 I am using the enterprise version.
So as an admin administrator, I am not able to create data patches and I will have to ask a developer to do it to handle this matter. (Or do some csv import to update the attribute values)

Also, I think the "default value" should be used when there is no value set at all anywhere.(So no patch, import should be required) If you have a "No" set in the customer_entity_int (or whatever), then that "No" is not a default value, is a customer choice. That is the whole point of the default value. Think of it like a "default value" for a column in mysql. When you do an insert, without a value for that column, that value will just take the default value along the way automatically

So from my point of view, the default attribute value is used for nothing in there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Adobe Commerce The issue related to the Adobe Commerce(EE) or B2B functionality Area: Account Component: CustomerAttributes Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
None yet
Development

No branches or pull requests

5 participants