cancel
Showing results for 
Search instead for 
Did you mean: 

Order Confirmation Emails Addressed to 'Guest' post update

SOLVED

Order Confirmation Emails Addressed to 'Guest' post update

Hello,

After PayPal checkout, my order confirmation emails are addressed to 'Guest', not the name on the shipping/billing address regardless if customer was logged in or not on site.  Ship-to name and bill-to name are correctly mapped on back end.  The emails used to be addressed to the correct customer name from PayPal even if they were not logged in.

This is a new issue after upgrade from 2.3.5.  I am now running 2.4.1 but the issue has persisted in 2.3.6, 2.4.0 and 2.4.1.

Order confirmations for COD orders (not using PayPal) are addressed correctly to the customer name.  

I am getting the following in debug log:

[2020-11-25 03:31:29] main.DEBUG: URI '/customer/account/loginPost/referer/aHR0cHM6Ly9zdG9yZS5mcm9nc250aGluZ3MuY29tL2Ntcy9ub3JvdXRlL2luZGV4L3VlbmMvYUhSMGNITTZMeTl6ZEc5eVpTNW1jbTluYzI1MGFHbHVaM011WTI5dEwyUXRZWHAxY21WMWN5NW9kRzFzL3Byb2R1Y3QvMS8,/'' cannot be accessed with GET method (Magento\Customer\Controller\Account\LoginPost) [] []
[2020-11-25 03:31:29] main.DEBUG: Request validation failed for action "Magento\Customer\Controller\Account\LoginPost\Interceptor" {"exception":"[object] (Magento\\Framework\\App\\Request\\InvalidRequestException(code: 0): Invalid request received at /home/frogsnth/store.frogsnthings.com/vendor/magento/framework/App/Request/HttpMethodValidator.php:69)"} []
[2020-11-25 03:31:38] main.ERROR: Braintree\Configuration::merchantId needs to be set (or accessToken needs to be passed to Braintree\Gateway). [] []
[2020-11-25 03:31:43] main.DEBUG: URI '/checkout/cart/add/uenc/aHR0cHM6Ly9zdG9yZS5mcm9nc250aGluZ3MuY29tL3BsYW50cy9mcm9ncy1uLXRoaW5ncy1mcm9ncy5odG1sP3ByaWNlPS0xMDA,/product/20/'' cannot be accessed with GET method (Magento\Checkout\Controller\Cart\Add) [] []
[2020-11-25 03:31:43] main.DEBUG: Request validation failed for action "Magento\Checkout\Controller\Cart\Add\Interceptor" {"exception":"[object] (Magento\\Framework\\App\\Request\\InvalidRequestException(code: 0): Invalid request received at /home/frogsnth/store.frogsnthings.com/vendor/magento/framework/App/Request/HttpMethodValidator.php:69)"} []

I'd appreciate any suggestions you might have. Its not a huge deal, although hard to keep track of different orders among the emails all addressed to guest.

Thanks,

Keith

 

1 ACCEPTED SOLUTION

Accepted Solutions

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;
}

View solution in original post

13 REPLIES 13

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

the issue can be from email template. 

please check following : 

  • Login into Admin
  • Check template assigned for guest user under : 
    Store -> Configuration -> Sales -> Sales Emails -> New Order Confirmation Template for Guest

IF it's not the default template then check by assigning the default template. 

OR

IF its the default template then create a new template for New Order for Guest

  • Navigate to Marketing -> Email Templates 
  • Add New Template 

Load New Order for Guest template and check the greeting name.

you can try updating that with the followings 

<p class="greeting">{{trans "%name," name=$order.billing_address.name}}</p>

OR

<p class="greeting">{{trans "%name," name=$order.getBillingAddress().getName()}}</p>

kindly Accept as a Solution if this works for you and give Kudos. Smiley Happy 

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

Thank you,

I was using the default template.  I created a new template and get the same result using that.  If I replaced 

<p class="greeting">{{trans "%name," name=$order_data.customer_name}}</p>
<p>

with either suggestion, there is now no name or 'guest' in the email, just ", Thank you for....."

 

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

kindly use this variable

{{trans "%name," name=$order.billing_address.name}}

 

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

Thank you. That variable is not working: Here is the template code I have:

<table>
<tr class="email-intro">
<td>
<p class="greeting">{{trans "%name," name=$order.billing_address.name}}</p>
<p>
{{trans "Thank you for your order from %store_name." store_name=$store.frontend_name}}
{{trans "Once your package ships we will send an email with a link to track your order."}}

The emails have the name blank: ", Thank you for...."

 

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

I'm having the same issue with Mag 2.4.1 and PayPal.

As of Magento 2.3.4 all method calls are removed, so they can't be used.

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

Anyone find a solution yet?

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

You should build custom functionality for that.

See documentation: https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/templates/template-email-migration.html

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

We are experiencing a similar issue on our Magento 2.3.7-p2 website.

 

Just out of interest do you:

 - Use Redis? What is your Redis configuration

 - Use any form of One Step Checkout module?

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

Still have this issue. No to redis. No one step checkout although Buy Now with Paypal is enabled.