Skip to content

Adding Customer Custom attributes creating document files#446

Merged
meker12 merged 12 commits into
AdobeDocs:mainfrom
mtmmahi:add-custom-attributes
May 19, 2026
Merged

Adding Customer Custom attributes creating document files#446
meker12 merged 12 commits into
AdobeDocs:mainfrom
mtmmahi:add-custom-attributes

Conversation

@mtmmahi
Copy link
Copy Markdown
Contributor

@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
Contributor 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
Contributor 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
Contributor 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
Contributor 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
Contributor 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
Contributor 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
Contributor 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
Contributor 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
Contributor 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
Contributor 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
Contributor 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
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Linter Report

Click to expand full report
═══════════════════════════════════════════════════════════════
                     LINTER REPORT
═══════════════════════════════════════════════════════════════

Generated: 2026-05-19T12:57:22.435Z
Mode: Full Linting (all rules + dead links check)
Target Directory: /home/runner/work/commerce-php/commerce-php
Skipped Rules:
  - check-frontmatter → src/pages/includes

───────────────────────────────────────────────────────────────

Files to process: 834

───────────────────────────────────────────────────────────────
📄 FILE: src/pages/coding-standards/technical-guidelines.md
───────────────────────────────────────────────────────────────
  ⚠️  WARNING
    Location: Line 589:128
    Message: Unexpected dead URL `https://en.wikipedia.org/wiki/Universally_unique_identifier`, expected live URL
    Rule: no-dead-urls

  ⚠️  WARNING
    Location: Line 677:46
    Message: Unexpected dead URL `https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol`, expected live URL
    Rule: no-dead-urls

───────────────────────────────────────────────────────────────
📄 FILE: src/pages/development/backward-incompatible-changes/index.md
───────────────────────────────────────────────────────────────
  ⚠️  WARNING
    Location: Line 1041:49
    Message: Unexpected dead URL `https://www.php.net/manual/en/class.throwable.php`, expected live URL
    Rule: no-dead-urls

  ⚠️  WARNING
    Location: Line 425:37
    Message: Unexpected dead URL `https://eat.magento.com/ui/phpFqn?searchKey=TWFnZW50b1xGcmFtZXdvcmtcQ29uc29sZVxDbGk6OmdldERlZmF1bHRDb21tYW5kcw==`, expected live URL
    Rule: no-dead-urls

───────────────────────────────────────────────────────────────
📄 FILE: src/pages/tutorials/admin/custom-boolean-field-attribute.md
───────────────────────────────────────────────────────────────
  ⚠️  WARNING
    Location: Line 2:1
    Message: Title is too long (62 characters). Consider keeping it under 60 characters.
    Rule: check-frontmatter

───────────────────────────────────────────────────────────────
📄 FILE: src/pages/tutorials/admin/custom-dropdown-field-attribute.md
───────────────────────────────────────────────────────────────
  ⚠️  WARNING
    Location: Line 2:1
    Message: Title is too long (63 characters). Consider keeping it under 60 characters.
    Rule: check-frontmatter

───────────────────────────────────────────────────────────────
📄 FILE: src/pages/tutorials/admin/custom-multiselect-field-attribute.md
───────────────────────────────────────────────────────────────
  ⚠️  WARNING
    Location: Line 2:1
    Message: Title is too long (66 characters). Consider keeping it under 60 characters.
    Rule: check-frontmatter


═══════════════════════════════════════════════════════════════
                        SUMMARY
═══════════════════════════════════════════════════════════════

  📁 Files processed:    834
  📄 Files with issues:  5
  ❌ Total errors:       0
  ⚠️  Total warnings:     7
  📋 Total issues:       7

Result: ⚠️  PASSED WITH WARNINGS - No fatal errors

═══════════════════════════════════════════════════════════════

This comment was automatically generated by the linter bot.

auto-merge was automatically disabled May 19, 2026 16:45

Head branch was pushed to by a user without write access

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Linter Report

Click to expand full report
═══════════════════════════════════════════════════════════════
                     LINTER REPORT
═══════════════════════════════════════════════════════════════

Generated: 2026-05-19T19:52:55.102Z
Mode: Full Linting (all rules + dead links check)
Target Directory: /home/runner/work/commerce-php/commerce-php
Skipped Rules:
  - check-frontmatter → src/pages/includes

───────────────────────────────────────────────────────────────

Files to process: 834

───────────────────────────────────────────────────────────────
📄 FILE: src/pages/development/backward-incompatible-changes/index.md
───────────────────────────────────────────────────────────────
  ⚠️  WARNING
    Location: Line 1041:49
    Message: Unexpected dead URL `https://www.php.net/manual/en/class.throwable.php`, expected live URL
    Rule: no-dead-urls

  ⚠️  WARNING
    Location: Line 425:37
    Message: Unexpected dead URL `https://eat.magento.com/ui/phpFqn?searchKey=TWFnZW50b1xGcmFtZXdvcmtcQ29uc29sZVxDbGk6OmdldERlZmF1bHRDb21tYW5kcw==`, expected live URL
    Rule: no-dead-urls

───────────────────────────────────────────────────────────────
📄 FILE: src/pages/development/package/component.md
───────────────────────────────────────────────────────────────
  ⚠️  WARNING
    Location: Line 147:33
    Message: Unexpected dead URL `https://packagist.org/`, expected live URL
    Rule: no-dead-urls


═══════════════════════════════════════════════════════════════
                        SUMMARY
═══════════════════════════════════════════════════════════════

  📁 Files processed:    834
  📄 Files with issues:  2
  ❌ Total errors:       0
  ⚠️  Total warnings:     3
  📋 Total issues:       3

Result: ⚠️  PASSED WITH WARNINGS - No fatal errors

═══════════════════════════════════════════════════════════════

This comment was automatically generated by the linter bot.

Add missing newline at the end of the file.
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Linter Report

Click to expand full report
═══════════════════════════════════════════════════════════════
                     LINTER REPORT
═══════════════════════════════════════════════════════════════

Generated: 2026-05-19T20:22:19.193Z
Mode: Full Linting (all rules + dead links check)
Target Directory: /home/runner/work/commerce-php/commerce-php
Skipped Rules:
  - check-frontmatter → src/pages/includes

───────────────────────────────────────────────────────────────

Files to process: 834

───────────────────────────────────────────────────────────────
📄 FILE: src/pages/best-practices/security/index.md
───────────────────────────────────────────────────────────────
  ⚠️  WARNING
    Location: Line 21:111
    Message: Unexpected dead URL `https://wiki.owasp.org/index.php/Guide_to_Cryptography#Hashes`, expected live URL
    Rule: no-dead-urls

  ⚠️  WARNING
    Location: Line 19:130
    Message: Unexpected dead URL `https://cheatsheetseries.owasp.org/cheatsheets/Injection_Prevention_Cheat_Sheet.html#scripting-languages`, expected live URL
    Rule: no-dead-urls

───────────────────────────────────────────────────────────────
📄 FILE: src/pages/development/backward-incompatible-changes/index.md
───────────────────────────────────────────────────────────────
  ⚠️  WARNING
    Location: Line 425:37
    Message: Unexpected dead URL `https://eat.magento.com/ui/phpFqn?searchKey=TWFnZW50b1xGcmFtZXdvcmtcQ29uc29sZVxDbGk6OmdldERlZmF1bHRDb21tYW5kcw==`, expected live URL
    Rule: no-dead-urls

───────────────────────────────────────────────────────────────
📄 FILE: src/pages/development/security/non-secure-functions.md
───────────────────────────────────────────────────────────────
  ⚠️  WARNING
    Location: Line 20:111
    Message: Unexpected dead URL `https://wiki.owasp.org/index.php/Guide_to_Cryptography#Hashes`, expected live URL
    Rule: no-dead-urls

───────────────────────────────────────────────────────────────
📄 FILE: src/pages/module-reference/module-customer-import-export.md
───────────────────────────────────────────────────────────────
  ⚠️  WARNING
    Location: Line 35:3
    Message: Unexpected dead URL `https://experienceleague.adobe.com/en/docs/commerce-admin/systems/data-transfer/data-export`, expected live URL
    Rule: no-dead-urls


═══════════════════════════════════════════════════════════════
                        SUMMARY
═══════════════════════════════════════════════════════════════

  📁 Files processed:    834
  📄 Files with issues:  4
  ❌ Total errors:       0
  ⚠️  Total warnings:     5
  📋 Total issues:       5

Result: ⚠️  PASSED WITH WARNINGS - No fatal errors

═══════════════════════════════════════════════════════════════

This comment was automatically generated by the linter bot.

@meker12 meker12 merged commit 66f8b69 into AdobeDocs:main May 19, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from 👍 Approved to 🏁 Done in Commerce - Pull Requests May 19, 2026
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: 🏁 Done

Development

Successfully merging this pull request may close these issues.

4 participants