Skip to content

Commit f1f7dad

Browse files
committed
MC-4242: Newsletter subscriptions per website
1 parent 16d0cfc commit f1f7dad

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/code/Magento/CustomerGraphQl/Model/Resolver/IsSubscribed.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\CustomerGraphQl\Model\Resolver;
99

10+
use Magento\Customer\Api\Data\CustomerInterface;
1011
use Magento\Framework\Exception\LocalizedException;
1112
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
1213
use Magento\Framework\GraphQl\Config\Element\Field;
@@ -45,10 +46,12 @@ public function resolve(
4546
if (!isset($value['model'])) {
4647
throw new LocalizedException(__('"model" value should be specified'));
4748
}
48-
/** @var Customer $customer */
49+
/** @var CustomerInterface $customer */
4950
$customer = $value['model'];
51+
$customerId = (int)$customer->getId();
52+
$websiteId = (int)$customer->getWebsiteId();
53+
$status = $this->subscriberFactory->create()->loadByCustomer($customerId, $websiteId)->isSubscribed();
5054

51-
$status = $this->subscriberFactory->create()->loadByCustomerId((int)$customer->getId())->isSubscribed();
5255
return (bool)$status;
5356
}
5457
}

0 commit comments

Comments
 (0)