For this first you need to create one product attribute like Salebale with Yes/No
value
then need to add condition on minicart.phtml
app/design/frontend/Yourpackage/Yourtheme/Magento_Checkout/templates/cart/minicart.phtml
Here First you need to get current product as you need to hide minicart from product page so to get current product use below code
<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get('Magento\Framework\Registry')->registry('current_product');//get current product
echo $product->getId();
echo $product->getName();
?>
Or Add bellow code in your block file.
for example
app/code/Packagename/Modulename/Block/CustomBlock.php
<?php
namespace Packagename\Modulename\Block;
class CustomBlock extends \Magento\Framework\View\Element\Template
{
protected $_registry;
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\Registry $registry,
array $data = []
)
{
$this->_registry = $registry;
parent::__construct($context, $data);
}
public function _prepareLayout()
{
return parent::_prepareLayout();
}
public function getCurrentProduct()
{
return $this->_registry->registry('current_product');
}
}
?>
Printing current product data in your template (custom.phtml) file
if ($currentProduct = $block->getCurrentProduct()) {
echo $currentProduct->getName() . '<br />';
}
So when you get the current product object then get saleable attribute value using current product like below
<?php $saleable = $currentProduct->getSalebale(); ?>
then in above mentioned minicart.phtml add condition to show minicart only on Saleable product page.
put all minicart code in condition like
<?php if($saleable): ?>
/******* Minicart content **********/
<?php endif; ?>