Helper/Order.php
private function setAddress($quoteAddress, $address)
    {
        $address = $this->cartHelper->handleSpecialAddressCases($address);

        $region = $this->regionModel->loadByName(@$address->region, @$address->country_code);

        $addressData = [
            'firstname'    => @$address->first_name,
            'lastname'     => @$address->last_name,
            'street'       => trim(@$address->street_address1 . "\n" . @$address->street_address2),
            'city'         => @$address->locality,
            'country_id'   => @$address->country_code,
            'region'       => @$address->region,
            'postcode'     => @$address->postal_code,
            'telephone'    => @$address->phone_number,
            'region_id'    => $region ? $region->getId() : null,
            'company'      => @$address->company,
        ];

        if ($this->cartHelper->validateEmail(@$address->email_address)) {
            $addressData['email'] = $address->email_address;
        }

        // discard empty address fields
        foreach ($addressData as $key => $value) {
            if (empty($value)) {
                unset($addressData[$key]);
            }
        }

        $quoteAddress->setShouldIgnoreValidation(true);
        $quoteAddress->addData($addressData)->save();
    }
private function setAddress($quoteAddress, $address)
    {
        $address = $this->cartHelper->handleSpecialAddressCases($address);

        $region = $this->regionModel->loadByName(@$address->region, @$address->country_code);

        $addressData = [
            'firstname'    => @$address->first_name,
            'lastname'     => @$address->last_name,
            'street'       => trim(@$address->street_address1 . "\n" . @$address->street_address2),
            'city'         => @$address->locality,
            'country_id'   => @$address->country_code,
            'region'       => @$address->region,
            'postcode'     => @$address->postal_code,
            'telephone'    => @$address->phone_number,
            'region_id'    => $region ? $region->getId() : null,
            'company'      => @$address->company,
        ];

        if ($this->cartHelper->validateEmail(@$address->email_address)) {
            $addressData['email'] = $address->email_address;
        }

        // discard empty address fields
        foreach ($addressData as $key => $value) {
            if (empty($value)) {
                unset($addressData[$key]);
            }
        }

        $quoteAddress->setShouldIgnoreValidation(true);
        $quoteAddress->addData($addressData)->save();
    }
private function setAddress ( $ quoteAddress , $ address ) { $ address = $ this -> cartHelper -> handleSpecialAddressCases ( $ address ) ; $ region = $ this -> regionModel -> loadByName ( @ $ address -> region , @ $ address -> country_code ) ; $ addressData = [ 'firstname' => @ $ address -> first_name , 'lastname' => @ $ address -> last_name , 'street' => trim ( @ $ address -> street_address1 . "\n" . @ $ address -> street_address2 ) , 'city' => @ $ address -> locality , 'country_id' => @ $ address -> country_code , 'region' => @ $ address -> region , 'postcode' => @ $ address -> postal_code , 'telephone' => @ $ address -> phone_number , 'region_id' => $ region ? $ region -> getId ( ) : null , 'company' => @ $ address -> company , ] ; if ( $ this -> cartHelper -> validateEmail ( @ $ address -> email_address ) ) { $ addressData [ 'email' ] = $ address -> email_address ; } // discard empty address fields foreach ( $ addressData as $ key => $ value ) { if ( empty ( $ value ) ) { unset ( $ addressData [ $ key ] ) ; } } $ quoteAddress -> setShouldIgnoreValidation ( true ) ; $ quoteAddress -> addData ( $ addressData ) -> save ( ) ; }
Set Quote address data helper method.

@param Address $quoteAddress
@param $address

@throws \Exception
Set Quote address data helper method .