Model/Catalog/UrlFinder.php
private function getScopedProduct($product)
    {
        if (!in_array($product->getStoreId(), $product->getStoreIds())) {

            $productInWebsites = $product->getWebsiteIds();
            $firstWebsite = $this->storeManager->getWebsite($productInWebsites[0]);
            $storeId = (int) $firstWebsite->getDefaultGroup()->getDefaultStoreId();

            return $this->productRepository->getById($product->getId(), false, $storeId);
        }

        return $product;
    }
private function getScopedProduct($product)
    {
        if (!in_array($product->getStoreId(), $product->getStoreIds())) {

            $productInWebsites = $product->getWebsiteIds();
            $firstWebsite = $this->storeManager->getWebsite($productInWebsites[0]);
            $storeId = (int) $firstWebsite->getDefaultGroup()->getDefaultStoreId();

            return $this->productRepository->getById($product->getId(), false, $storeId);
        }

        return $product;
    }
private function getScopedProduct ( $ product ) { if ( ! in_array ( $ product -> getStoreId ( ) , $ product -> getStoreIds ( ) ) ) { $ productInWebsites = $ product -> getWebsiteIds ( ) ; $ firstWebsite = $ this -> storeManager -> getWebsite ( $ productInWebsites [ 0 ] ) ; $ storeId = ( int ) $ firstWebsite -> getDefaultGroup ( ) -> getDefaultStoreId ( ) ; return $ this -> productRepository -> getById ( $ product -> getId ( ) , false , $ storeId ) ; } return $ product ; }
In default-level catalog sync, the supplied Product's store ID can be 1 even though the product is not in store 1
This method finds the default store of the first website the product belongs to, and uses that to get a new product.

@param \Magento\Catalog\Model\Product $product

@return \Magento\Catalog\Api\Data\ProductInterface|\Magento\Catalog\Model\Product
@throws \Magento\Framework\Exception\LocalizedException
@throws \Magento\Framework\Exception\NoSuchEntityException
In default - level catalog sync the supplied Product s store ID can be 1 even though the product is not in store 1 This method finds the default store of the first website the product belongs to and uses that to get a new product .