Helper/Cart.php
public function replicateQuoteData($source, $destination)
    {
        // Skip the replication if source and destination point to the same quote
        // E.g. delayed Save Order - immutable quote is cleared by cron and we use the parent instead
        if ($source->getId() == $destination->getId()) return;

        $destinationId = $destination->getId();
        $destinationActive = (bool)$destination->getIsActive();

        $destination->removeAllItems();

        $destination->merge($source);

        $destination->getBillingAddress()->setShouldIgnoreValidation(true);
        $this->transferData($source->getBillingAddress(), $destination->getBillingAddress());

        $destination->getShippingAddress()->setShouldIgnoreValidation(true);
        $this->transferData($source->getShippingAddress(), $destination->getShippingAddress());

        $this->transferData($source, $destination, false);

        $destination->setId($destinationId);
        $destination->setIsActive($destinationActive);

        $this->quoteResourceSave($destination);

        // If Amasty Gif Cart Extension is present clone applied gift cards
        $this->discountHelper->cloneAmastyGiftCards($source->getId(), $destination->getId());
    }
public function replicateQuoteData($source, $destination)
    {
        // Skip the replication if source and destination point to the same quote
        // E.g. delayed Save Order - immutable quote is cleared by cron and we use the parent instead
        if ($source->getId() == $destination->getId()) return;

        $destinationId = $destination->getId();
        $destinationActive = (bool)$destination->getIsActive();

        $destination->removeAllItems();

        $destination->merge($source);

        $destination->getBillingAddress()->setShouldIgnoreValidation(true);
        $this->transferData($source->getBillingAddress(), $destination->getBillingAddress());

        $destination->getShippingAddress()->setShouldIgnoreValidation(true);
        $this->transferData($source->getShippingAddress(), $destination->getShippingAddress());

        $this->transferData($source, $destination, false);

        $destination->setId($destinationId);
        $destination->setIsActive($destinationActive);

        $this->quoteResourceSave($destination);

        // If Amasty Gif Cart Extension is present clone applied gift cards
        $this->discountHelper->cloneAmastyGiftCards($source->getId(), $destination->getId());
    }
public function replicateQuoteData ( $ source , $ destination ) { // Skip the replication if source and destination point to the same quote // E.g. delayed Save Order - immutable quote is cleared by cron and we use the parent instead if ( $ source -> getId ( ) == $ destination -> getId ( ) ) return ; $ destinationId = $ destination -> getId ( ) ; $ destinationActive = ( bool ) $ destination -> getIsActive ( ) ; $ destination -> removeAllItems ( ) ; $ destination -> merge ( $ source ) ; $ destination -> getBillingAddress ( ) -> setShouldIgnoreValidation ( true ) ; $ this -> transferData ( $ source -> getBillingAddress ( ) , $ destination -> getBillingAddress ( ) ) ; $ destination -> getShippingAddress ( ) -> setShouldIgnoreValidation ( true ) ; $ this -> transferData ( $ source -> getShippingAddress ( ) , $ destination -> getShippingAddress ( ) ) ; $ this -> transferData ( $ source , $ destination , false ) ; $ destination -> setId ( $ destinationId ) ; $ destination -> setIsActive ( $ destinationActive ) ; $ this -> quoteResourceSave ( $ destination ) ; // If Amasty Gif Cart Extension is present clone applied gift cards $ this -> discountHelper -> cloneAmastyGiftCards ( $ source -> getId ( ) , $ destination -> getId ( ) ) ; }
Clone quote data from source to destination

@param Quote $source
@param Quote $destination
@throws \Magento\Framework\Exception\AlreadyExistsException
@throws \Zend_Validate_Exception
Clone quote data from source to destination