I have a plugin to reorder the address lines in Commerce. Basically to move the Phone Number to the bottom as it drives all my clients nuts.

While the final array, addressLines is the correct array and all looks ok it does not seem to be passing $addressLines back into getAddressLines function in /src/models/Address.php Am I missing the obvious here or is there a bug?

            function(DefineAddressLinesEvent $event) {
                // @var array $addressLines
                $addressLines = $event->addressLines;
                // Modify default address lines array
                $addressLinesNewOrder = [
                    'custom3' ,
            uksort($addressLines, function($x, $y) use ($addressLinesNewOrder) {
                return array_search($x, $addressLinesNewOrder) > array_search($y, $addressLinesNewOrder);

        return $addressLines;


https://craftcms.com/docs/commerce/3.x/addresses.html#address-lines https://craftcms.com/docs/commerce/3.x/extend/events.html#defineaddresslines


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.