public function aroundAddAttributeToSelect(
        \Magento\Catalog\Model\ResourceModel\Product\Collection $subject,
        \Closure $proceed,
        $attribute,
        $joinType = false
    ) {
        /** @var \Magento\Catalog\Model\ResourceModel\Product\Collection $result */
        $result = $proceed($attribute, $joinType);
        if ($attribute == AProdAttr::CODE_PRICE) {
            $query = $result->getSelect();
            $this->queryAddWrhsPrice($query);
        } elseif ($attribute == AProdAttr::CODE_SPECIAL_PRICE) {
            $query = $result->getSelect();
            $this->queryAddWrhsGroupPrice($query);
        }
        return $result;
    }
public function aroundAddAttributeToSelect(
        \Magento\Catalog\Model\ResourceModel\Product\Collection $subject,
        \Closure $proceed,
        $attribute,
        $joinType = false
    ) {
        /** @var \Magento\Catalog\Model\ResourceModel\Product\Collection $result */
        $result = $proceed($attribute, $joinType);
        if ($attribute == AProdAttr::CODE_PRICE) {
            $query = $result->getSelect();
            $this->queryAddWrhsPrice($query);
        } elseif ($attribute == AProdAttr::CODE_SPECIAL_PRICE) {
            $query = $result->getSelect();
            $this->queryAddWrhsGroupPrice($query);
        }
        return $result;
    }
public function aroundAddAttributeToSelect ( \ Magento \ Catalog \ Model \ ResourceModel \ Product \ Collection $ subject , \ Closure $ proceed , $ attribute , $ joinType = false ) { /** @var \Magento\Catalog\Model\ResourceModel\Product\Collection $result */ $ result = $ proceed ( $ attribute , $ joinType ) ; if ( $ attribute == AProdAttr :: CODE_PRICE ) { $ query = $ result -> getSelect ( ) ; $ this -> queryAddWrhsPrice ( $ query ) ; } elseif ( $ attribute == AProdAttr :: CODE_SPECIAL_PRICE ) { $ query = $ result -> getSelect ( ) ; $ this -> queryAddWrhsGroupPrice ( $ query ) ; } return $ result ; }
Add warehouse price to product collection if 'price' attribute is added to select.
Add warehouse group price to product collection if 'special_price' attribute is added to select.

@param \Magento\Catalog\Model\ResourceModel\Product\Collection $subject
@param \Closure $proceed
@param array $attribute
@param bool|string $joinType
@return \Magento\Catalog\Model\ResourceModel\Product\Collection
Add warehouse price to product collection if price attribute is added to select . Add warehouse group price to product collection if special_price attribute is added to select .