0

Currently, I am in the customer address form

block

\Magento\Customer\Block\Address\Edit $block 

How to use $block and get the street address of the customer address. I tracked the street address is stored in customer_address_entity table in the street column.

0

So looking at the code providing you are within \Magento\Customer\Block\Address\Edit

https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Customer/Block/Address/Edit.php

https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Customer/Block/Address/Edit.php#L263-L267

$block->getStreetLine(1);
$block->getStreetLine(2);
$block->getStreetLine(3);
$block->getStreetLine(4);
$block->getStreetLine(5);

But if that doesn't work try

https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Customer/Block/Address/Edit.php#L252

\Magento\Customer\Api\Data\AddressInterface

https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Customer/Api/Data/AddressInterface.php

https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Customer/Api/Data/AddressInterface.php#L121

It will be an array

$address = $block->getAddress();
var_dump($address->getStreet());
1
  • @Dominice var_dump($address->getStreet()); gives me null, and the first is already giving me empty result – summu Jun 13 '19 at 6:21

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.