Magento - How to untick "Use Default Value" on a Super product attribute programmatically?

Magento - How to untick "Use Default Value" on a Super product attribute programmatically?

October 2, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento - How to untick "Use Default Value" on a Super product attribute programmatically?

Unchecking “Use Default Value” for Magento Super Product Attributes

As a senior developer, I understand your frustration with having to manually untick the “Use Default Value” checkboxes for super product attributes in Magento. This is an important feature that can cause inconsistencies if not managed properly.

Understanding the Context

When you create a configurable product, Magento allows you to set options like size or color, each of which can have its own price and other values. The “Use Default Value” checkbox determines whether this option should use the default value for the configurable product or a specific value for that particular combination.

By unticking this box, you ensure that your customers see the correct prices and attributes for each variation of your product, regardless of which store view they are using.

Locating the Database Schema

To manage this behavior programmatically, we need to understand where Magento stores this information. The catalog_product_entity_int table is where most of the product attribute data is stored in the database.

The relevant columns here are:

  • entity_id: The ID of the product (the parent configurable product).
  • attribute_id: The ID of the super attribute.
  • store_id: The ID of the store view where this value applies.
  • value: The actual value assigned to this attribute for a specific combination.

Modifying the Values

To untick the “Use Default Value” checkbox, we need to remove or modify these values. However, simply deleting them won’t work because Magento uses these values even when the box is ticked.

Instead, we’ll set the value column to NULL for each of these attributes in every store view.

Here’s a simple example of how you could do this using MySQL:

-- Untick "Use Default Value" for all super attributes in all store views
DELETE FROM catalog_product_entity_int
WHERE attribute_id IN (
    -- List of IDs for your super attributes (color, size, etc.)
    SELECT entity_id FROM catalog_eav_attribute WHERE attribute_code LIKE 'super_attribute_%'
)
AND store_id > 0;

This SQL statement deletes the value column for all products that have a “super attribute” ID in any store view with an ID greater than 0 (a default value).

Implementing This Programmatically

If you prefer to do this programmatically, you can use Magento’s API or even its Model layer. Here’s a simple example using the Magento\Catalog\Model\Product class:

<?php
namespace Vendor\Module\Controller;

use Magento\Framework\App\Action;
use Magento\Catalog\Model\ProductFactory;

class UntickDefaultValue implements Action
{
    protected $_productFactory;

    public function __construct(ProductFactory $productFactory)
    {
        $this->_productFactory = $productFactory;
    }

    public function execute()
    {
        // Fetch all products
        $products = $this->_productFactory->create()->getCollection();

        foreach ($products as $product) {
            if ($product->getTypeId() == 'configurable') {
                $childIds = $product->getTypeInstance()
                    ->getUsedProductIds($product);

                // For each child, clear the values in all store views
                foreach ($childIds as $childId) {
                    $childProduct = $this->_productFactory->create()->load($childId);
                    $childProduct->setStoreId(null)->save();
                }
            }
        }
    }
}

This PHP script fetches all products, checks if they are configurable, and then clears the product values for each child in all store views. Remember to replace Vendor\Module with your actual module name.

Conclusion

Unticking “Use Default Value” programmatically is a complex task that requires understanding of both the database schema and Magento’s object-oriented architecture.

The provided SQL statement offers a direct approach, while the PHP script demonstrates how you can use Magento’s API to achieve the same result in a more controlled manner.

Remember, always test these changes thoroughly on your development environment before deploying them to production, as this could significantly affect your storefront behavior and pricing logic.

If you have any questions or need further assistance, feel free to reach out. You can also find more detailed guides and tutorials on Magento’s official documentation at https://laravelcompany.com/magento-documentation.

Catalog Database Themes Configuration

Our network