public function execute(\Magento\Framework\Event\Observer $observer)
    {
        /** @var \Magento\Quote\Api\Data\CartInterface $quote */
        $quote = $observer->getQuote();

        /** @var \Magento\Quote\Api\Data\AddressInterface $shippingAddress */
        $shippingAddress = $quote->getShippingAddress();
        if ($shippingAddress) {
            $shippingMethod = $shippingAddress->getShippingMethod();
            if ($shippingMethod) {
                $methodCode = \Smile\StoreDelivery\Model\Carrier::METHOD_CODE;
                $carrier    = $this->carrierFactory->getIfActive($methodCode);
                if ($carrier && $shippingMethod === sprintf('%s_%s', $methodCode, $carrier->getCarrierCode())) {
                    $billingAddress = $quote->getBillingAddress();

                    if (!$shippingAddress->getFirstname()) {
                        $shippingAddress->setFirstname($billingAddress->getFirstname());
                    }
                    if (!$shippingAddress->getLastname()) {
                        $shippingAddress->setLastname($billingAddress->getLastname());
                    }
                    if (!$shippingAddress->getTelephone()) {
                        $shippingAddress->setTelephone($billingAddress->getTelephone());
                    }
                }
            }
        }
    }
public function execute(\Magento\Framework\Event\Observer $observer)
    {
        /** @var \Magento\Quote\Api\Data\CartInterface $quote */
        $quote = $observer->getQuote();

        /** @var \Magento\Quote\Api\Data\AddressInterface $shippingAddress */
        $shippingAddress = $quote->getShippingAddress();
        if ($shippingAddress) {
            $shippingMethod = $shippingAddress->getShippingMethod();
            if ($shippingMethod) {
                $methodCode = \Smile\StoreDelivery\Model\Carrier::METHOD_CODE;
                $carrier    = $this->carrierFactory->getIfActive($methodCode);
                if ($carrier && $shippingMethod === sprintf('%s_%s', $methodCode, $carrier->getCarrierCode())) {
                    $billingAddress = $quote->getBillingAddress();

                    if (!$shippingAddress->getFirstname()) {
                        $shippingAddress->setFirstname($billingAddress->getFirstname());
                    }
                    if (!$shippingAddress->getLastname()) {
                        $shippingAddress->setLastname($billingAddress->getLastname());
                    }
                    if (!$shippingAddress->getTelephone()) {
                        $shippingAddress->setTelephone($billingAddress->getTelephone());
                    }
                }
            }
        }
    }
public function execute ( \ Magento \ Framework \ Event \ Observer $ observer ) { /** @var \Magento\Quote\Api\Data\CartInterface $quote */ $ quote = $ observer -> getQuote ( ) ; /** @var \Magento\Quote\Api\Data\AddressInterface $shippingAddress */ $ shippingAddress = $ quote -> getShippingAddress ( ) ; if ( $ shippingAddress ) { $ shippingMethod = $ shippingAddress -> getShippingMethod ( ) ; if ( $ shippingMethod ) { $ methodCode = \ Smile \ StoreDelivery \ Model \ Carrier :: METHOD_CODE ; $ carrier = $ this -> carrierFactory -> getIfActive ( $ methodCode ) ; if ( $ carrier && $ shippingMethod === sprintf ( '%s_%s' , $ methodCode , $ carrier -> getCarrierCode ( ) ) ) { $ billingAddress = $ quote -> getBillingAddress ( ) ; if ( ! $ shippingAddress -> getFirstname ( ) ) { $ shippingAddress -> setFirstname ( $ billingAddress -> getFirstname ( ) ) ; } if ( ! $ shippingAddress -> getLastname ( ) ) { $ shippingAddress -> setLastname ( $ billingAddress -> getLastname ( ) ) ; } if ( ! $ shippingAddress -> getTelephone ( ) ) { $ shippingAddress -> setTelephone ( $ billingAddress -> getTelephone ( ) ) ; } } } } }
Set mandatory fields to shipping address from the billing one, if needed.

This can occur when using Store Delivery, since the Shipping Address is set before the Billing.
In this case, the shipping address may not have the proper value for FirstName, LastName, and Telephone.

@event checkout_submit_before

@param \Magento\Framework\Event\Observer $observer The observer
Set mandatory fields to shipping address from the billing one if needed .