@@ -99,7 +99,7 @@ public function generateInvoice($orderId, $paymentIntentId)
9999 }
100100 }
101101
102- public function setQuoteAddresses ($ shippingAddress , $ email , $ quote )
102+ public function setQuoteAddresses ($ shippingAddress , $ email , $ quote, $ customer )
103103 {
104104 $ name = $ shippingAddress ['name ' ];
105105 $ phoneNumber = $ shippingAddress ['phoneNumber ' ];
@@ -124,6 +124,7 @@ public function setQuoteAddresses($shippingAddress, $email, $quote)
124124 $ names = $ this ->getNames ($ name );
125125 $ shippingAddress ->setFirstname ($ names [0 ]);
126126 $ shippingAddress ->setLastname ($ names [1 ]);
127+ $ shippingAddress ->setPrefix ($ customer ->getPrefix ());
127128 $ shippingAddress ->setTelephone ($ phoneNumber );
128129 $ shippingAddress ->setCity ($ locality );
129130 $ shippingAddress ->setRegionCode ($ administrativeArea );
@@ -153,10 +154,11 @@ private static function rand_string($length) {
153154 * @param string $shallCreate
154155 * @param string $sid
155156 * @param string $quoteId
157+ * @param string $prefix
156158 *
157159 * @return string
158160 */
159- public function orderPostMethod ($ shippingAddress ,$ paymentIntentId ,$ shippingOptionId , $ paymentMethod , $ email , $ shallCreate , $ sid , $ quoteId )
161+ public function orderPostMethod ($ shippingAddress ,$ paymentIntentId ,$ shippingOptionId , $ paymentMethod , $ email , $ shallCreate , $ sid , $ quoteId, $ prefix )
160162 {
161163 $ redirectUrl = $ this ->urlBuilder ->getUrl ('checkout/onepage/failure ' , ['_secure ' => true ]);
162164 try {
@@ -185,6 +187,7 @@ public function orderPostMethod($shippingAddress,$paymentIntentId,$shippingOptio
185187 ->setPassword ($ this ->rand_string (12 ))
186188 ->setFirstname ($ names [0 ])
187189 ->setLastname ($ names [1 ])
190+ ->setPrefix ($ prefix )
188191 ->save ();
189192 $ this ->customerSession ->setCustomerAsLoggedIn ($ customer );
190193 $ customerId = true ;
@@ -221,7 +224,7 @@ public function orderPostMethod($shippingAddress,$paymentIntentId,$shippingOptio
221224 }
222225
223226 $ quote ->reserveOrderId ()->save ();
224- $ this ->setQuoteAddresses ($ shippingAddress , $ email , $ quote );
227+ $ this ->setQuoteAddresses ($ shippingAddress , $ email , $ quote, $ customer );
225228 $ quote ->getShippingAddress ()->setShippingMethod ($ shippingOptionId );
226229 $ this ->shippingRate
227230 ->setCode ($ shippingOptionId )
0 commit comments