I tried the below code in custom controller and cron job method [just load and save] after that I felt some issues
$product = $this->productRepository->getById(548); $this->productRepository->save($product); From Controller:
- It change the product type from simple to virtual
- No issues in product detail page
- It removes the product from category page.
From Cron
- It change the product type from simple to virtual
- product detail page goes to 404 page not found
- It removes the product from category page.
Update
I checked the same in Magento 2.1.3
From Cron
- It change the product type from simple to virtual
- No issues in product detail page
- It removes the product from category page.
is there any limitation to use product repository in cron? or did I something wrong?