- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2021
10:33 AM
07-14-2021
10:33 AM
Hide some products in grid product
Hello,
I would like to hide specific products in product list (admin).
The products not to be displayed start with the string S_ in the sku.
These products should not be viewed by a specific group.
How can I do?
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2021
12:42 AM
07-17-2021
12:42 AM
Re: Hide some products in grid product
First load all your Sku in which string S_ present using
product collection load and addFieldToFilter like query used
After Get All Sku which contain string S_ disable all
product skus using repository save
$product = $this->productRepository->get($sku); $product->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_DISABLED); $this->productRepository->save($product);
Thank You