I've created InstallData for creating product attribute with default options to be set yes like,

used_in_product_listing and is_used_for_promo_rules

Probelm is only used_in_product_listing is setting up to Yes while execute InstallData not for Promo Code Rule.

        \Magento\Catalog\Model\Product::ENTITY, 'brands', [
            'type' => 'text',
            'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend',
            'frontend' => '',
            'label' => 'Brands',
            'input' => 'select',
            'group' => 'General',
            'class' => 'brands',
            'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
            'visible' =>    true,
            'required' => false,
            'user_defined' => true,
            'default' => '1',
            'searchable' => false,
            'filterable' => false,
            'comparable' => false,
            'visible_on_front' => false,
            'is_used_for_promo_rules' => true,
            'used_in_product_listing' => true,
            'unique' => false

Can anyone guide me regarding this ?

Your Answer

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

Browse other questions tagged or ask your own question.