@@ -249,7 +249,7 @@ public function sendAbandonedCartData($quoteId = null): array
249249
250250 $ quote = $ this ->quoteRepository ->get ($ abandonedCart ->getEntityId ());
251251 $ AcCustomer = NULL ;
252- if ($ this ->isGuest ($ quote ) || ($ abandonedCart ->getCustomerId () && !$ this ->getCustomer ($ abandonedCart ->getCustomerId ())->getCustomerId ())) {
252+ if ($ this ->isGuest ($ quote ) || ($ abandonedCart ->getCustomerId () && !$ this ->getCustomer ($ abandonedCart ->getCustomerId ())->getId ())) {
253253 $ customerEmail = $ quote ->getBillingAddress ()->getEmail ();
254254 if (!$ customerEmail ) {
255255 $ result ['error ' ] = __ ('Customer Email does not exist. ' );
@@ -270,6 +270,10 @@ public function sendAbandonedCartData($quoteId = null): array
270270 $ abandonedCart ->collectTotals ();
271271 $ quoteItemsData = $ this ->getQuoteItemsData ($ abandonedCart ->getEntityId (), $ abandonedCart ->getStoreId ());
272272 $ abandonedCartRepository = $ this ->quoteRepository ->get ($ abandonedCart ->getId ());
273+ $ abandonedUpdateDate = $ abandonedCartRepository ->getUpdatedAt ();
274+ if (is_null ($ abandonedUpdateDate )){
275+ $ abandonedUpdateDate = $ abandonedCartRepository ->getCreatedAt ();
276+ }
273277 $ timezone = $ this ->dateTime ->getConfigTimezone (\Magento \Store \Model \ScopeInterface::SCOPE_STORES , $ abandonedCart ->getStoreId ());
274278 $ abandonedCartData = [
275279 "ecomOrder " => [
@@ -281,9 +285,9 @@ public function sendAbandonedCartData($quoteId = null): array
281285 "discountAmount " => $ this ->coreHelper ->priceToCents ($ abandonedCart ->getDiscountAmount ())
282286 ],
283287 "orderUrl " => $ this ->urlBuilder ->getDirectUrl ('checkout/cart ' ),
284- "abandonedDate " => $ this ->dateTime ->date (strtotime ($ abandonedCartRepository -> getUpdatedAt () ),NULL ,$ timezone )->format ('Y-m-d\TH:i:sP ' ),
288+ "abandonedDate " => $ this ->dateTime ->date (strtotime ($ abandonedUpdateDate ),NULL ,$ timezone )->format ('Y-m-d\TH:i:sP ' ),
285289 "externalCreatedDate " => $ this ->dateTime ->date (strtotime ($ abandonedCartRepository ->getCreatedAt ()),NULL ,$ timezone )->format ('Y-m-d\TH:i:sP ' ),
286- "externalUpdatedDate " => $ this ->dateTime ->date (strtotime ($ abandonedCartRepository -> getUpdatedAt () ),NULL ,$ timezone )->format ('Y-m-d\TH:i:sP ' ),
290+ "externalUpdatedDate " => $ this ->dateTime ->date (strtotime ($ abandonedUpdateDate ),NULL ,$ timezone )->format ('Y-m-d\TH:i:sP ' ),
287291 "shippingMethod " => $ abandonedCart ->getShippingAddress ()->getShippingMethod (),
288292 "totalPrice " => $ this ->coreHelper ->priceToCents ($ abandonedCart ->getGrandTotal ()),
289293 "shippingAmount " => $ this ->coreHelper ->priceToCents ($ abandonedCart ->getShippingAmount ()),
0 commit comments