Skip to content

Commit

Permalink
Merge pull request #7 from AleksandrsKondratjevs/issue-2473
Browse files Browse the repository at this point in the history
issue-2473 - Return null in case if product not assigned to website
  • Loading branch information
carinadues authored Jun 9, 2021
2 parents e585e8f + df3414e commit 0d45cb2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Model/Resolver/EntityUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ public function resolve(
if ($type === 'PRODUCT') {
// Using this instead of factory due https://github.com/magento/magento2/issues/12278
$collection = $this->productCollectionFactory->create()
->addAttributeToFilter('status', ['eq' => Status::STATUS_ENABLED]);
->addAttributeToFilter('status', ['eq' => Status::STATUS_ENABLED])
->addWebsiteFilter($this->storeManager->getWebsite());
$product = $collection->addIdFilter($id)->getFirstItem();
if (!$product->hasData()) {
return null;
Expand Down

0 comments on commit 0d45cb2

Please sign in to comment.