Skip to main content
added 35 characters in body
Source Link

public function Address() {

public function Address() {  $customerId = "8";   $customer = $this->customerRepository->getById($customerId);   $addresses = $customer->getAddresses();   $billingAddress = $customer->getDefaultBilling();   $shippingAddress = $customer->getDefaultShipping();   return $billingAddress;    } 

In this code am only getting the id i want the address as string.please help me..

public function Address() {

 $customerId = "8"; $customer = $this->customerRepository->getById($customerId); $addresses = $customer->getAddresses(); $billingAddress = $customer->getDefaultBilling(); $shippingAddress = $customer->getDefaultShipping(); return $billingAddress;   } 

In this code am only getting the id i want the address as string.please help me..

public function Address() {  $customerId = "8";   $customer = $this->customerRepository->getById($customerId);   $addresses = $customer->getAddresses();   $billingAddress = $customer->getDefaultBilling();   $shippingAddress = $customer->getDefaultShipping();   return $billingAddress;  } 

In this code am only getting the id i want the address as string.please help me..

Source Link
srg
  • 465
  • 3
  • 12
  • 27

In magento 2 how can i programatically get customer full addresses in string type?

public function Address() {

 $customerId = "8"; $customer = $this->customerRepository->getById($customerId); $addresses = $customer->getAddresses(); $billingAddress = $customer->getDefaultBilling(); $shippingAddress = $customer->getDefaultShipping(); return $billingAddress; } 

In this code am only getting the id i want the address as string.please help me..

1
2