Skip to content

I Want to validate condition rule on category page products in magento 2

here is my Code
public function checkCondition()
{
// $PrId = $this->_registry->registry(‘current_product’);
// $prdId = $PrId->getId();
$categoryId = $this->getRequest()->getParam(‘id’);

 $ruleColl = $this->customConditionModel->create()->getCollection();
 foreach ($ruleColl as $ruleKey => $ruleVal) {
    $prdData = $this->categoryFactory->create()->load($categoryId);
    $Data[] = $ruleVal->getConditions()->getName();
 }
  $data = isset($Data);
 if($Data == false){
     echo '';
 }else{
    return $Data;
 }

// $data1 = $prdData->getId();
// print_r($data1);die();

it give false