cart customer details fetched when user logged in

This commit is contained in:
Prashant Singh 2018-12-21 18:48:31 +05:30
parent 089aaadb71
commit 2b8e198d0d
1 changed files with 10 additions and 3 deletions

View File

@ -639,9 +639,16 @@ class Cart {
}
}
$cart->customer_email = $cart->billing_address->email;
$cart->customer_first_name = $cart->billing_address->first_name;
$cart->customer_last_name = $cart->billing_address->last_name;
if(auth()->guard('customer')->check()) {
$cart->customer_email = auth()->guard('customer')->user()->email;
$cart->customer_first_name = auth()->guard('customer')->user()->first_name;
$cart->customer_last_name = auth()->guard('customer')->user()->last_name;
} else {
$cart->customer_email = $cart->billing_address->email;
$cart->customer_first_name = $cart->billing_address->first_name;
$cart->customer_last_name = $cart->billing_address->last_name;
}
$cart->save();
return true;