Magento 2 is well known for it’s capacity to extending the features. Today’s article we will be discussing how to get product collection based on custom attribute (drop down attribute value).
For dropdown attribute, We can filter using dropdown option ID instead of Label.
So your code is like below.
$productcollection = $this->_productCollection ->addAttributeToSelect('*') ->addAttributeToFilter('brand', 20) ->load();
The above 20 is the value from the drop down in the admin area. In my case, that was a brand called Sony.