Plugin/Magento/Quote/Model/Quote.php
public function aroundGetCustomerGroupId(
        \Magento\Quote\Model\Quote $subject,
        \Closure $proceed
    ) {
        /* call parent to get group ID and to process other around-plugins */
        $result = $proceed();
        if ($result == \Magento\Customer\Model\GroupManagement::NOT_LOGGED_IN_ID) {
            /* check referral code in registry for guest visitors */
            $code = $this->hlpReferral->getReferralCode();
            if ($code) {
                /* return referral group id if code exists */
                $result = $this->hlpConfig->getReferralsGroupReferrals();
            }
        }
        return $result;
    }
public function aroundGetCustomerGroupId(
        \Magento\Quote\Model\Quote $subject,
        \Closure $proceed
    ) {
        /* call parent to get group ID and to process other around-plugins */
        $result = $proceed();
        if ($result == \Magento\Customer\Model\GroupManagement::NOT_LOGGED_IN_ID) {
            /* check referral code in registry for guest visitors */
            $code = $this->hlpReferral->getReferralCode();
            if ($code) {
                /* return referral group id if code exists */
                $result = $this->hlpConfig->getReferralsGroupReferrals();
            }
        }
        return $result;
    }
public function aroundGetCustomerGroupId ( \ Magento \ Quote \ Model \ Quote $ subject , \ Closure $ proceed ) { /* call parent to get group ID and to process other around-plugins */ $ result = $ proceed ( ) ; if ( $ result == \ Magento \ Customer \ Model \ GroupManagement :: NOT_LOGGED_IN_ID ) { /* check referral code in registry for guest visitors */ $ code = $ this -> hlpReferral -> getReferralCode ( ) ; if ( $ code ) { /* return referral group id if code exists */ $ result = $ this -> hlpConfig -> getReferralsGroupReferrals ( ) ; } } return $ result ; }
Replace NOT_LOGGED_IN group for referral customers.

@param \Magento\Quote\Model\Quote $subject
@param \Closure $proceed
@return int|mixed
Replace NOT_LOGGED_IN group for referral customers .