I have written cron to crate customer, but while running code through cron, I am getting error as
A customer website ID must be specified when using the website scope
code to get website id:
$websiteId = $this->storeManager->getWebsite()->getWebsiteId();
$this->storeManager is instance of class:
\Magento\Store\Model\StoreManager
But that code always return 0(zero) as website id which result in error. Is there any way to get website or store id in cron?