$shippingId =
$this->db->
lastInsertId();
$shippingAddressId = null;
if ($this->session !== null
) { $shippingAddressId =
$this->session->
get('checkoutShippingAddressId'
);
} if ($shippingAddressId === null
) { /** @var Customer $customer */
$customer =
$this->modelManager->
getRepository(Customer::
class)->
find($address['userID'
]);
$defaultShippingAddress =
$customer->
getDefaultShippingAddress();
if (!
$defaultShippingAddress instanceof Address
) { throw new RuntimeException('Customer does not have a default billing address'
);
} $shippingAddressId =
$defaultShippingAddress->
getId();
} $attributes =
$this->attributeLoader->
load('s_user_addresses_attributes',
$shippingAddressId);
$this->attributePersister->
persist($attributes, 's_order_shippingaddress_attributes',
$shippingId);
return $result;
}