I've added a product attribute by adding the following to InstallData.php within my module.

            'type' => 'int',
            'label' => 'Free from the following allergens',
            'input' => 'multiselect',
            'required' => false,
            'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend',
            'global' => Attribute::SCOPE_GLOBAL,
            'visible' => true,
            'user_defined' => false,
            'searchable' => false,
            'filterable' => true,
            'filterable_in_search' => true,
            'comparable' => false,
            'visible_on_front' => false,
            'unique' => false,
            'group' => 'General',
            'is_used_in_grid' => true,
            'is_visible_in_grid' => false,
            'is_filterable_in_grid' => true,
            'label' => [
                'values' => [

I've checked this attribute in the CMS, and i can see it's marked as filterable with results, and use in layered navigation is set to true. The issue is that it's not appearing alongside the other filters in my custom layered navigation.

$block->getFilters() is retrieving the filter,

but when i echo the results echo $filter->getItemsCount() it's showing 0 results? Even though i have products with this attribute assigned.

The product deffinately has the attribute saved correctly, so i'm not sure what's happening here.

Any help would be appreciated.


  • did you rebuild your indexes?
    – Marius
    Commented Jun 8, 2016 at 14:47
  • i ran php bin/magento indexer:reindex from the CL Commented Jun 8, 2016 at 15:21

1 Answer 1


I inadvertently created the attributes as system attributes, i added 'system' => 0 where i added the attribute and this seems to have resolved the issue.

  • instead of 'system'=>0 you should have used the following user_defined' => true, to set system. Anyway I can't see this new attribute in the layered navigation even has the same values as other I created through the backend..
    – Jordi
    Commented Jan 25, 2017 at 12:08

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.