I need to get Customer Firstname and Lastname from Abandon Guest checkout Cart. I am not getting a proper solution with my searching on Google.

Anyone have any idea about this.

enter image description here Thanks!

  • 1
    You will get this data only after customer fill the Billing or Shipping Address. And you need to take name from that addresses. Jun 1, 2021 at 5:24
  • Yes after filling the billing or shipping address
    – Shomita
    Jun 1, 2021 at 5:28

1 Answer 1


try this code.

public function __construct(
    \Magento\Framework\App\Action\Context $context,
    \Magento\Checkout\Model\Session $session,
) {
    $this->session = $session;

public function execute()
    $customerFirstname = $this->session->getQuote()->getShippingAddress()->getData("firstname");
    $customerLastname = $this->session->getQuote()->getShippingAddress()->getData("lastname"); 
  • Are you sure this will work?
    – Shomita
    Jun 1, 2021 at 5:48
  • This is not working
    – Shomita
    Jun 1, 2021 at 5:58
  • Code updated, check that one, but sure customer enter the shipping address. Jun 1, 2021 at 6:01
  • Yes i have filled the customer shipping details. But the firstname is showing in quote_address table but not showing in my log file.
    – Shomita
    Jun 1, 2021 at 6:13
  • I need to show in cron.php file. This is only working in simple phtml file with object manager otherwise it's showing NULL
    – Shomita
    Jun 1, 2021 at 6:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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