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?
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