LokiCheckout_AddressFieldManager

Other
Professional
PHP 8.1 - 8.4
Magento 2.4.7 | 2.4.8
CSP Yes
Unit Tests 30
PHPStan 5
Magento PHPCS 10

Magento version PHP version License Latest Version

This Magento 2 module is an add-on package to the LokiCheckout.

Installation

Install this package via composer:

composer require loki-checkout/magento2-address-field-manager

Next, enable this module:

bin/magento module:enable LokiCheckout_AddressFieldManager

Usage

The module adds an Admin Panel grid under Customers > Loki Checkout Address Fields. The grid lists every customer_address EAV attribute and allows the label, sort order, CSS class and grid spans to be edited inline.

The Country ID filter switches the scope that is being edited. Without a filter, the edits are stored as a global override (country ''). With a filter, the edits are stored for that country only, and the global override is used as a fallback for anything not overridden. The filter never changes which attributes are listed: all address attributes remain visible under every filter.

Current limitations

  • This module is admin-only. The overrides are stored, listed and merged in the Admin Panel, but they do not influence the storefront checkout yet. LokiCheckout Core reads its labels from the EAV attributes and its grid spans from XML configuration, so it currently ignores the values stored by this module.
  • Only the sort order of a global (unfiltered) edit is written back to the EAV attribute itself, since that is the one value Magento already honours everywhere. All other values are stored in the module its own table, customer_address_attribute_loki, and are never written back into EAV.
  • Creating new address attributes is not implemented yet: only existing attributes can be managed.

Current status

Static Tests Unit Tests Integration Tests Playwright DI Compilation

WARNING: This module has no releases yet. If you want to use it, make sure to add the version @dev to the composer command.

Support

For getting support, create an Issue under the following project URL:

https://gitlab.yireo.com/loki-checkout/LokiCheckout_AddressFieldManager.git

Loki Components

The following LokiComponents are created or references in this module:

loki-checkout-address-field-manager.grid loki-checkout-address-field-manager.form
Module Dependencies

The following dependencies are declared in the module its `etc/module.xml` file:

LokiCheckout_Core Loki_AdminComponents Loki_Base Loki_Components Loki_CssUtils Loki_FieldComponents Loki_MapComponents Magento_Backend Magento_Catalog Magento_Checkout Magento_CheckoutAgreements Magento_Config Magento_Customer Magento_Directory Magento_Eav Magento_Newsletter Magento_Payment Magento_Quote Magento_Sales Magento_Shipping Magento_Store Magento_Tax Magento_Theme Magento_Ui Magento_Vault Yireo_CspUtilities
Composer details
Magento module name
LokiCheckout_AddressFieldManager
Composer name
loki-checkout/magento2-address-field-manager
Composer version
No release yet
Default branch
main
Requirements
loki-checkout/magento2-core: ^2.3
loki/magento2-admin-components: ~0.6
magento/framework: ^103.0
magento/module-backend: ^102.0
magento/module-customer: ^103.0
magento/module-eav: ^102.1
magento/module-store: ^101.1
php: >=8.2 <8.6
Releases
Changelog

Fixed

  • Saving a field no longer wipes the frontend_label of the underlying customer_address EAV attribute. The admin label is stored in customer_address_attribute_loki.field_label instead.
  • The grid no longer fatals on load: it read the grid filter through a method that does not exist in Loki_AdminComponents.
  • A non-string grid filter value no longer causes a TypeError; it is treated as "any country".
  • Editing a field while a country filter is active no longer overwrites the global EAV sort order.
  • Overrides are no longer duplicated on every save. Reading and writing now agree on a single representation of the country scope, and a unique constraint enforces it.
  • The stored sort order override is now actually applied (it was written to a misspelled property).
  • An invalid CSS class is rejected before anything is persisted, instead of after the EAV attribute had already been saved.

Changed

  • country_id is NOT NULL DEFAULT '', where an empty value means "any country". A nullable column could not prevent duplicate scope rows, because MySQL treats NULLs as distinct in a unique index.
  • eav_attribute_id is now smallint unsigned, matching eav_attribute.attribute_id, so a foreign key with ON DELETE CASCADE could be added.
  • col_span and md_col_span are now integers, matching what LokiCheckout Core consumes. A value of 0 means "inherit".
  • Defaults are read from the configured LokiCheckout grid layout rather than being hardcoded.
  • css_class is now an editable grid column and is validated.
  • The EAV plugin is registered for the frontend only and no longer overrides existing values.
  • The module no longer mutates shared EAV-cached attribute objects when building the grid.

Added

  • Unique constraint on (eav_attribute_id, country_id) and a foreign key to eav_attribute.
  • i18n/en_US.csv.
  • Unit test suite.

Note

This release changes the table definition of customer_address_attribute_loki. Any existing rows with a NULL country, a duplicate (attribute, country) pair, or a non-integer column span must be migrated before upgrading.

Last modified: June 1, 2026