1. Created custom product attribute set Bag Size based on Default attribute set
  2. Created custom attribute bag_size and added 4 custom swatches i.e. bag sizes
  3. Created 4 simple products with different size and assigned to created attribute set
  4. Created configurable product and under Configuration added those simple products manually

Getting below error and unable to create configurable product.

enter image description here

Following the same process of creating configurable product where simple products are created and assigned to one configurable product.

Attribute Properties

enter image description here

Attribute Advanced Properties

enter image description here

  • I think an attribute needs some properties, so that it can be used for a configurable product (e.g. global scope). Please add a screenshot of your attribute properties.
    – Simon
    Commented Sep 27, 2017 at 7:24

6 Answers 6


So that an attribute can be used for configurable products, it has to have the following properties:

  • scope is set to global
  • attribute is visible
  • attribute is user defined
  • attribute uses a source (which is e.g. the case for dropdown and multiselect attributes)

See \Magento\ConfigurableProduct\Model\Product\Type\Configurable::canUseAttribute.

  • Properties screenshot updated under Attribute Advanced Properties. Am I still missing something ? I have tried creating a configurable product and add configuration. Still it is not creating any product. Also it throws exception while saving new configurable product - Attribute with attributeCode "156" does not exist. Commented Sep 27, 2017 at 9:09
  • @Vikram you cannot use "Text Swatch" for "Catalog Input Type for Store Owner". You have to set it to "Drodown".
    – Simon
    Commented Sep 27, 2017 at 10:12
  • Could you please explain why dropdown instead of Text Swatch ? Also by changing Catalog Input Type for Store Owner to Dropdown, it says Attribute with attributeCode "X" does not exist. Commented Sep 27, 2017 at 11:37
  • @Vikram I cannot explain why text swatch does not work. I can only say that Magento blocks other input types. You have to use "Dropdown". See the mentioned method. The other error message is another question.
    – Simon
    Commented Sep 27, 2017 at 12:49

this is the good code to create a product attribute that can be used for configurable product tested on Magento 2.3.

The required parameters are :

'source'=> \Magento\Eav\Model\Entity\Attribute\Source\Table::class
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
'user_defined' => true,
'visible' => true,

complete code

            'group' => 'Erp',
            'type' => 'int',
            'label' => 'Taille',
            'input' => 'select',
            'required' => false,
            'sort_order' => 20,
            'position'=> 0,
            'source'=> \Magento\Eav\Model\Entity\Attribute\Source\Table::class,
            'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
            'user_defined' => true,
            'is_used_in_grid' => true,
            'is_visible_in_grid' => true,
            'is_filterable_in_grid' => true,
            'visible' => true,
            'is_html_allowed_on_front' => false,
            'visible_on_front' => false

In my case I have to add around 3000 attribute values. For that reason I created attribute and its options progrmmatically. When I try to use this attributes in product level it was giving trouble.

I had the same problem when I try to edit the product. After some short of experiment, I created attribute manually and added its options progrmmatically that solved my problem. And ensure the scope of attribute to Global, Visible on Catalog Pages on Storefront to Yes.


In addition to @Simon's answer:

  1. Text Swatches can be used for creating configurable products. If you're adding the attribute programmatically, just make sure you use


as source_model.

  1. Also, if you're adding the attribute programmatically, make sure you don't add any value to the field "apply_to" (found in catalog_eav_attribute). Don't know why, didn't bother to find out.

In case where your get this error because attribute have been added programmatically and

$attribute->getIsUserDefined() equal false mean it's a system attribut then

you can run sql query :

UPDATE `dpx_eav_attribute` SET `is_user_defined` = '1' WHERE `dpx_eav_attribute`.`attribute_code` = "{your attribut code}";

Just been debugging this since the above did not help. Found another issue in the following file: \Magento\ConfigurableProduct\Model\ConfigurableAttributeHandler::isAttributeApplicable

We had this issue with migrated attributes from m1. The method above checks if attribute apply_to is empty or exactly matches

$types = [

This was not the case for us. So, cases where attribute apply_to is set to simple,configurable for example won't show up in the configurable wizard.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.