I have tried to remove the Add to cart button with many solutions out there, but none has worked. I'm using this solution: How to remove the Add to Cart button from Catalog pages in Magento 2?.
Also tried this one but the products were disabled, not the add to cart button: How to disable add to cart in magento 2
What I need to do, is something very simple, I just need to check in an if() condition if the ProductID of the product is different than 2 ids, so customer won't be able to add to cart products that are not the ones that can be bought.
Something like this is what I need to accomplish.
$productId = $product->getId();
if($productId != "2078" || $productId != "2079"){
//disable the add to cart button of the rest of products
}
else{
//products ID are 2078 or 2079
return true;
}
Greetings!