public function getLoadedProductCollection()
            $this->_limit = (int) $this->getWidgetCfg('limit');
            $type = $this->getTypeFilter();
            $fn = 'get' . ucfirst($type) . 'Products';
            $collection = $this->{$fn}();

            echo "<pre>";
            $condition = $this->getWidgetCfg('parameters');

            if ($this->_stockConfig->isShowOutOfStock() != 1) {
                ['collection' => $collection]

        return $collection;

how to use condition do a filter product list in Magento 2.please give me your answer.

this is a product list I want to filter and condition(var_dump)

enter image description here

  • Please clarify the condition which you want to apply on product list. – KKR Jul 30 at 9:41
  • how to clarify the condition. That's what I'm asking. please give me your answer. if you know. thank. – MichaelHa Jul 30 at 9:45
  • Which products you want to get in product list ? – KKR Jul 30 at 9:46
  • This is a list of filtered products in a different way and I want to add the filter by the condition. – MichaelHa Jul 30 at 9:50

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.