1

I have created custom attribute with multiselect option using code. Its created all the custom attributes, After product Import, multiselect attribute not coming to Shopping options. But viewed in Product Details.

If i created custom attribute manually its viewed in Shopping Options but, using code its created , but not viewed in shopping option.

reference:

enter image description here

This is my code:

   $eavSetup->addAttribute(

        \Magento\Catalog\Model\Product::ENTITY,
        'c_bathrooms',/* Custom Attribute Code */
        [
            'group' => 'Product Details',/* Group name in which you want to display your custom attribute */
            'type' => 'text',/* Data type in which formate your value save in database*/
            'attribute_set' =>  'Attribute Name',
            'backend' => '',
            'frontend' => '',
            'label' => 'Bathrooms', /* lablel of your attribute*/
            'input' => 'multiselect',
            'class' => '',
            'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
            'visible' => true,
            'required' => true,
            'user_defined' => true,
            'default' => '',
            'searchable' => true,
            'filterable' => true,
            'comparable' => true,
            'visible_on_front' => true,
            'used_in_product_listing' => true,
            'unique' => false,
            'visible_in_advanced_search' => true,
            'filterable_in_search' => true,
            'option' => [
                'values' => [
                    '1',
                    '2',
                    '3',
                    '4',
                    '5'
                ]
            ]
        ]
    );

Suggest me, What i Miss and how to fix this issue

Note: if I remove and recreate CustomAttribute, Some custom custom attribute view. not all the multiselect option attribute viewed.

2

I have given and answer of this question.

Please check this link:

Adding custom product attributes to layered navigation but not shown

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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