cancel
Showing results for 
Search instead for 
Did you mean: 

Order Confirmation Emails Addressed to 'Guest' post update

SOLVED

Re: Order Confirmation Emails Addressed to 'Guest' post update

It is still an issue in Magento 2.4.3, until now i was not able to find a good solution.

Re: Order Confirmation Emails Addressed to 'Guest' post update

Overwrite file: vendor/magento/module-paypal/Model/Express/Checkout.php

Update function:

 

protected function prepareGuestQuote() {
$quote = $this->_quote;
$quote->setCustomerId(null)
->setCustomerFirstname($quote->getBillingAddress()->getFirstname())
->setCustomerLastname($quote->getBillingAddress()->getLastname())
->setCustomerEmail($quote->getBillingAddress()->getEmail())
->setCustomerIsGuest(true)
->setCustomerGroupId(\Magento\Customer\Model\Group::NOT_LOGGED_IN_ID);
return $this;
}

Re: Order Confirmation Emails Addressed to 'Guest' post update

can you help me with this? i'm having the same issue here. thanks

Thanks! Kudos to us!

Re: Order Confirmation Emails Addressed to 'Guest' post update

Just getting back to this and solution by Peter_n works! Awesome!

I am now running Mag2.4.4 and noticed the file is somewhat updated, but no matter:  Simply add the 2 lines in below to the last function in the in the file noted by Peter_n (it's all the way at the end of the file).

            ->setCustomerFirstname($quote->getBillingAddress()->getFirstname())
            ->setCustomerLastname($quote->getBillingAddress()->getLastname())

It will look like this:

 protected function prepareGuestQuote()
    {
        $quote = $this->_quote;
        $billingAddress = $quote->getBillingAddress();

        /* Check if Guest customer provided an email address on checkout page, and in case
        it was provided, use it as priority, if not, use email address returned from PayPal.
        (Guest customer can place order two ways: - from checkout page, where guest is asked to provide
        an email address that later can be used for account creation; - from mini shopping cart, directly
        proceeding to PayPal without providing an email address */
        $email = $billingAddress->getOrigData('email') !== null
            ? $billingAddress->getOrigData('email') : $billingAddress->getEmail();

        $quote->setCustomerId(null)
            ->setCustomerFirstname($quote->getBillingAddress()->getFirstname())
            ->setCustomerLastname($quote->getBillingAddress()->getLastname())
            ->setCustomerEmail($email)
            ->setCustomerIsGuest(true)
            ->setCustomerGroupId(\Magento\Customer\Model\Group::NOT_LOGGED_IN_ID);
        return $this;
    }