Skip to content

Adding Customer Custom attributes creating document files#446

Open
mtmmahi wants to merge 10 commits into
AdobeDocs:mainfrom
mtmmahi:add-custom-attributes
Open

Adding Customer Custom attributes creating document files#446
mtmmahi wants to merge 10 commits into
AdobeDocs:mainfrom
mtmmahi:add-custom-attributes

Conversation

@mtmmahi
Copy link
Copy Markdown

@mtmmahi mtmmahi commented Apr 23, 2026

Purpose of this pull request

This pull request adds tutorials for 3 additional custom customer attribute types (boolean, dropdown, and multiselect) to the Adobe Commerce PHP documentation.

Key Changes

  • Configuration Update: Updated /src/pages/config.md to include navigation links to all three new tutorial pages
  • Supporting Assets: Added 2 new image files to document the visual appearance of custom attributes in the Admin UI
  • Base Template: These tutorials extend the existing "Create a text field attribute" documentation

New Topics & Documentation Pages

whatsnew
Add tutorials showing how to extend Adobe Commerce customer attributes with three commonly-used field types, providing developers with step-by-step code implementations, dependency injection patterns, and data patch lifecycle management (including reversible rollback functionality):

@github-project-automation github-project-automation Bot moved this to 📋 Needs Review in Commerce - Pull Requests Apr 23, 2026
@mtmmahi mtmmahi closed this Apr 23, 2026
@github-project-automation github-project-automation Bot moved this from 📋 Needs Review to 🏁 Done in Commerce - Pull Requests Apr 23, 2026
@mtmmahi mtmmahi reopened this Apr 23, 2026
@github-project-automation github-project-automation Bot moved this from 🏁 Done to 🧑‍💻 In Progress in Commerce - Pull Requests Apr 23, 2026
@@ -0,0 +1,419 @@
---
title: Add a Custom boolean Field Attribute | Commerce PHP Extensions
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boolean should be capitalised. Should be:

title: Add a Custom Boolean Field Attribute | Commerce PHP Extensions

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ttitle Updated

The factory is stored rather than a single `CustomerSetup` instance, because both `apply()` and `revert()` need to create their own instance.

```php
<?php declare(strict_types=1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This snippet is a method-level excerpt, not a complete PHP file. The <?php declare(strict_types=1); opening tag should not appear here — it is only appropriate at the top of a full file. Please remove this line from the snippet.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed it from code snippet

### Code reference

```php
<?php declare(strict_types=1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<?php and declare(strict_types=1); must each be on their own line, consistently across the document.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated as per the comment

@@ -0,0 +1,412 @@
---
title: Add a Custom dropdown Field Attribute | Commerce PHP Extensions
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dropdown should be capitalised. Should be:

title: Add a Custom Dropdown Field Attribute | Commerce PHP Extensions

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ttitle Updated


![Custom attribute in the customer grid](../../images/tutorials/custom-attribute-customer-grid.png)

To remove the attribute, run `bin/magento setup:rollback` and target this patch. The `revert()` method will execute and delete the attribute from the system.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<?php and declare(strict_types=1); must each be on their own line, consistently across the document.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the code

@@ -0,0 +1,416 @@
---
title: Add a Custom boolean Field Attribute | Commerce PHP Extensions
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The title says boolean — copied from the boolean file and not updated. Should be:

title: Add a Custom Multiselect Field Attribute | Commerce PHP Extensions

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the title

@@ -0,0 +1,416 @@
---
title: Add a Custom boolean Field Attribute | Commerce PHP Extensions
description: Follow this tutorial to create a custom boolean field attribute for Adobe Commerce or Magento Open Source.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description also says boolean field attribute — copied from the boolean file and not updated. Should be:

description: Follow this tutorial to create a custom multiselect field attribute for Adobe Commerce or Magento Open Source.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the Description


This tutorial describes how a developer can create a custom multiselect attribute for the Customer entity using code. This will reflect in both the [Customer Grid](https://experienceleague.adobe.com/en/docs/commerce-admin/customers/customer-accounts/manage/manage-account) and the [Customer Form](https://experienceleague.adobe.com/en/docs/commerce-admin/customers/customer-accounts/manage/update-account) in the Admin.

Use a multiselect attribute when you need to store multiple simultaneous values for a single customer field — for example, eligible shipping methods, allowed sales channels, or subscription preferences. Unlike the [dropdown attribute](custom-dropdown-attribute.md), which stores a single selected option ID as an integer, a multiselect attribute stores a comma-separated list of option IDs as a `varchar` value, handled by the `ArrayBackend` backend model. This tutorial also implements `PatchRevertableInterface`, which allows the attribute to be cleanly removed by running `bin/magento setup:rollback`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken internal link: custom-dropdown-attribute.md does not exist in this PR — the dropdown file is named custom-dropdown-field-attribute.md. This will resolve automatically if the file naming issue is fixed by removing -field- from all filenames.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the internal link

### Code reference

```php
<?php declare(strict_types=1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<?php and declare(strict_types=1); must each be on their own line, consistently across the document.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated as per comment

$this->moduleDataSetup->getConnection()->endSetup();
}
}
``` No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File is missing a trailing newline character. This will cause a MD047/single-trailing-newline markdownlint failure in CI. Please add a newline after the closing code fence.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added new line et the end of the php snippet

@github-project-automation github-project-automation Bot moved this from 🧑‍💻 In Progress to 🛠 Changes Requested in Commerce - Pull Requests Apr 23, 2026
@mtmmahi
Copy link
Copy Markdown
Author

mtmmahi commented Apr 24, 2026

Implemented all changes as per the comments

Comment thread src/pages/tutorials/admin/custom-boolean-field-attribute.md
Comment thread src/pages/tutorials/admin/custom-boolean-field-attribute.md Outdated
Comment thread src/pages/tutorials/admin/custom-multiselect-field-attribute.md
mtmmahi and others added 3 commits April 27, 2026 18:38
Co-authored-by: Thiaramus <thiaramus@icloud.com>
Co-authored-by: Thiaramus <thiaramus@icloud.com>
Co-authored-by: Thiaramus <thiaramus@icloud.com>
@github-project-automation github-project-automation Bot moved this from 🛠 Changes Requested to 👍 Approved in Commerce - Pull Requests May 6, 2026
@meker12 meker12 self-assigned this May 15, 2026
@meker12 meker12 added technical Updates to the code or processes that alter the technical content of the doc new-topic A major update published as an entirely new document labels May 15, 2026
@meker12 meker12 enabled auto-merge May 15, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-topic A major update published as an entirely new document technical Updates to the code or processes that alter the technical content of the doc

Projects

Status: 👍 Approved

Development

Successfully merging this pull request may close these issues.

4 participants