Skip to content

Commit

Permalink
Add customer name to quote for guest orders (#267)
Browse files Browse the repository at this point in the history
Fixes customer name showing as "Guest" on orders caused by customer
name fields being set to `NULL` in database.
  • Loading branch information
JosephLeedy authored Jun 13, 2024
1 parent 52da312 commit cfceb1a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Model/Order/PlaceOrder/CreateOrderFromQuote.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ public function create(CartInterface $quote, OrderDataInterface $orderPayload):
private function prepareCartForCustomer(CartInterface $cart): void
{
if (!$cart->getCustomerId()) {
$cart->setCustomerPrefix($cart->getBillingAddress()->getPrefix());
$cart->setCustomerFirstname($cart->getBillingAddress()->getFirstname());
$cart->setCustomerMiddlename($cart->getBillingAddress()->getMiddlename());
$cart->setCustomerLastname($cart->getBillingAddress()->getLastname());
$cart->setCustomerSuffix($cart->getBillingAddress()->getSuffix());
$cart->setCustomerEmail($cart->getBillingAddress()->getEmail());
$cart->setCustomerIsGuest(true);
$cart->setCustomerGroupId(GroupManagement::NOT_LOGGED_IN_ID);
Expand Down

0 comments on commit cfceb1a

Please sign in to comment.