---
title: "Magento 2: How to Disable Specific Product Attribute in Catalog Price Rule"
url: "https://magecomp.com/blog/magento-2-disable-specific-product-attribute-in-catalog-price-rule/"
date: "2025-04-07T07:30:44+00:00"
modified: "2025-05-27T11:24:37+00:00"
author:
  name: "Dhiren Vasoya"
  url: "https://magecomp.com/"
categories:
  - "How To"
  - "Magento 2"
word_count: 293
reading_time: "2 min read"
summary: "Hello Magento Friends,"
description: "Learn how to disable specific product attributes in Magento 2 Catalog Price Rules to prevent them from appearing in promotional conditions."
keywords: "How To, Magento 2"
language: "en"
schema_type: "Article"
related_posts:
  - title: "How to Export all Products to a CSV File Programmatically using a Root Script in Magento 2?"
    url: "https://magecomp.com/blog/export-products-via-csv-magento-2/"
  - title: "How To Deal With SEO Traffic Loss Due To Magento 2 Migration?"
    url: "https://magecomp.com/blog/deal-seo-traffic-loss-due-magento-2-migration/"
  - title: "Magento 2 Porto Theme Review 2026 &#8211; Premium Responsive"
    url: "https://magecomp.com/blog/magento-2-porto-theme/"
---

# Magento 2: How to Disable Specific Product Attribute in Catalog Price Rule

_Published: April 7, 2025_  
_Author: Dhiren Vasoya_  

![How to Disable Specific Product Attribute in Catalog Price Rule](https://magecomp.com/blog/wp-content/uploads/2025/04/How-to-Disable-Specific-Product-Attribute-in-Catalog-Price-Rule-1024x512.webp)

**Hello Magento Friends,**

Magento 2’s Catalog Price Rules provide a powerful way to offer discounts based on product attributes. But sometimes, you might want to exclude certain custom attributes from being used in catalog price rules—for instance, to prevent misuse or maintain pricing consistency.

Learn –

[**Create Catalog Price Rules from the Admin Dashboard**](https://magecomp.com/blog/create-a-catalog-price-rule-magento-2/)

[**Create Catalog Price Rules Programmatically**](https://magecomp.com/blog/create-catalog-price-rule-magento-2-programmatically/)

In this blog, we’ll show you how to disable specific product attributes so they don’t appear in the conditions list of Catalog Price Rules in Magento 2.

[![Hire Magento Developer](https://magecomp.com/blog/wp-content/uploads/2025/01/hire-magento-4-1024x284.webp)](https://magecomp.com/services/hire-magento-programmer/)

## Steps to Disable Specific Product Attribute in Catalog Price Rule in Magento 2:
**Step 1:** First, we need to create a **“di.xml“** file inside our extension at the following path

**app\code\Vendor\Extension\etc\di.xml**

Now add the code as follows

```
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="MagentoCatalogRuleModelRuleConditionProduct">
        <plugin name="hide_specific_attribute_plugin" type="VendorExtensionPluginHideattribute" />
    </type>
</config>
```

**Step 2:** After that, we need to create a **“Hideattribute.php”** file inside our extension at the following path

**app\code\Vendor\Extension\Plugin\Hideattribute.php**

And add the code as given below

```
<?php
namespace VendorExtensionPlugin;

class Hideattribute
{
    public function afterLoadAttributeOptions(MagentoCatalogRuleModelRuleConditionProduct $subject, $result)
    {
        $attributes = $subject->getAttributeOption();
        $attributeToHide = 'your_attribute_code'; // Replace with your attribute code

        if (isset($attributes[$attributeToHide])) {
            unset($attributes[$attributeToHide]);
        }

        $subject->setAttributeOption($attributes);
        return $result;
    }
}
?>
```

## Conclusion:
Hence, this way you can disable a specific product attribute in a catalog price rule in Magento 2. Feel free to reach out in the comments if you have any questions or need help implementing this in your Magento 2 store!

**Happy Coding!**

[![Hire Magento Programmer](https://magecomp.com/blog/wp-content/uploads/2025/02/Hire-Magento-Programmer-CTA-2.webp)](https://magecomp.com/services/hire-magento-programmer/)


---

_View the original post at: [https://magecomp.com/blog/magento-2-disable-specific-product-attribute-in-catalog-price-rule/](https://magecomp.com/blog/magento-2-disable-specific-product-attribute-in-catalog-price-rule/)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-08-17 03:07:11 UTC_  
