I created an InstallData class to add category attribute with checkbox input type.
$eavSetup->addAttribute(\Magento\Catalog\Model\Category::ENTITY, 'attribute_id', [
'type' => 'int',
'label' => 'Your Category Attribute Name',
'input' => 'checkbox',
'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean',
'visible' => true,
'default' => '0',
'required' => false,
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
'group' => 'Display Settings',
]);
The attribute displays a checkbox properly on the admin category edit page, but saving the category does not save checked value. If I change the input type to 'boolean', catch error - "Class boolean doesn't exist". How can I fix it to save checkbox value?