magento2: Can not change product status which product created with productRepository
Preconditions
- Any supported Magento version
Steps to reproduce
$product = $objectManager->create(Product::class); $product->setTypeId(Type::TYPE_SIMPLE) ->setWebsiteIds([1]) ->setName(NAME) ->setSku(SKU) ->setPrice(10) ->setVisibility(Visibility::VISIBILITY_BOTH) ->setStatus(Status::STATUS_DISABLED) ->setCategoryIds(array(1,5,7)); try { $product = $productRepository->save($product); } catch (\Exception $e) { echo $e->getMessage(); }
Product created successfully.
In admin set ‘Enable Product’ true. But at product grid in admin, status seems ‘Disabled’.
Expected result
Product have to be online in website
Actual result
‘We can’t find products matching the selection.’ And product status seen Disabled in admin grid.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 28 (10 by maintainers)
Commits related to this issue
- Merge pull request #5664 from magento-chaika/Chaika-PR-20200510 Chaika-PR-20200510 — committed to magento/magento2 by dhorytskyi 4 years ago
Why is it still not fixed. It was reported on 16 July 2016. It is really serious issue @magento-engcom-team
@denisrpriebe There is still no solution, so I did the following work-around. It is not pretty but it works.
The same issue occurs when you insert a product with API.
I am having the same problem on 2.1.3
Easier solution would be to login the user… then you can use the the normal way to change status
An addition; If I change status via products grid (check checkbox of item, select ‘Change Status’->‘Enabled’ action) it is working fine