Model/AbandonedCart/CartInsight/Data.php
private function getProductImageUrl($item, $store)
    {
        $url = "";
        $base = $store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA, true) . 'catalog/product';

        $configurableProductImage = $this->scopeConfig->getValue(
            'checkout/cart/configurable_product_image',
            \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
            $store->getId()
        );

        if ($configurableProductImage === "itself") {

            // Use item SKU to retrieve properties of configurable products
            $id = $item->getProduct()->getIdBySku($item->getSku());
            $product = $this->productRepository->getById($id);

            if ($product->getThumbnail() !== "no_selection") {
                return $base . $product->getThumbnail();
            }
        }

        // Parent thumbnail
        if ($item->getProduct()->getThumbnail() !== "no_selection") {
            $url = $base . $item->getProduct()->getThumbnail();
        }

        return $url;
    }
private function getProductImageUrl($item, $store)
    {
        $url = "";
        $base = $store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA, true) . 'catalog/product';

        $configurableProductImage = $this->scopeConfig->getValue(
            'checkout/cart/configurable_product_image',
            \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
            $store->getId()
        );

        if ($configurableProductImage === "itself") {

            // Use item SKU to retrieve properties of configurable products
            $id = $item->getProduct()->getIdBySku($item->getSku());
            $product = $this->productRepository->getById($id);

            if ($product->getThumbnail() !== "no_selection") {
                return $base . $product->getThumbnail();
            }
        }

        // Parent thumbnail
        if ($item->getProduct()->getThumbnail() !== "no_selection") {
            $url = $base . $item->getProduct()->getThumbnail();
        }

        return $url;
    }
private function getProductImageUrl ( $ item , $ store ) { $ url = "" ; $ base = $ store -> getBaseUrl ( \ Magento \ Framework \ UrlInterface :: URL_TYPE_MEDIA , true ) . 'catalog/product' ; $ configurableProductImage = $ this -> scopeConfig -> getValue ( 'checkout/cart/configurable_product_image' , \ Magento \ Store \ Model \ ScopeInterface :: SCOPE_STORE , $ store -> getId ( ) ) ; if ( $ configurableProductImage === "itself" ) { // Use item SKU to retrieve properties of configurable products $ id = $ item -> getProduct ( ) -> getIdBySku ( $ item -> getSku ( ) ) ; $ product = $ this -> productRepository -> getById ( $ id ) ; if ( $ product -> getThumbnail ( ) !== "no_selection" ) { return $ base . $ product -> getThumbnail ( ) ; } } // Parent thumbnail if ( $ item -> getProduct ( ) -> getThumbnail ( ) !== "no_selection" ) { $ url = $ base . $ item -> getProduct ( ) -> getThumbnail ( ) ; } return $ url ; }
Get product image URL. We respect the "Configurable Product Image" setting in determining which image to retrieve.

@param \Magento\Quote\Model\Quote\Item $item
@param \Magento\Store\Api\Data\StoreInterface $store

@return string

@throws \Magento\Framework\Exception\NoSuchEntityException
Get product image URL . We respect the Configurable Product Image setting in determining which image to retrieve .