I used the below code and list out all the attribute options by current category wise. But, I want to list out available attribute options by selected attribute option with product results. In my case, some attribute option products count ZERO.

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
             $filterableAttributes = $objectManager->getInstance()->get(\Magento\Catalog\Model\Layer\Category\FilterableAttributeList::class);
             $layerResolver = $objectManager->getInstance()->get(\Magento\Catalog\Model\Layer\Resolver::class);
             $filterList = $objectManager->getInstance()->create(
                        'filterableAttributes' => $filterableAttributes,
            $layer = $layerResolver->get();
            $filters = $filterList->getFilters($layer);

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.