I have used Magento Plugin concept for custom collection on the category page. Everything is working fine except price filter in layered navigation.

Below code of di.xml

<type name="Magento\Catalog\Block\Product\ListProduct">
    <plugin name="mynamespace-mymodule-block-product-list"
            sortOrder="10" />

Below code of ProductList.php

public function beforeToHtml(\Magento\Catalog\Block\Product\ListProduct $subject )
    $skus = array('sku1','sku2');

    $layer = $subject->getLayer();

    $pcollection = $layer->getProductCollection()->clear()->addAttributeToFilter('sku', array('in' => $skus));      



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.