Magento – Price filter in layered navigation not working correctly with price including tax in magento 2.2.3

layered-navigationmagento2.2.3

I am using magento-2.2.3. and showing prices including tax on product list page.

Now the issue is the price filter in layered navigation is considering prices excluding tax. So how to change the layered navigation logic for that?

I am using custom third-party extension for layered navigation, but the same issue also exists with the extension disabled.

This issue has been fixed in later magento versions, but due to some constraints, i cnt go with version upgrade.

For better understanding, check this screenshot.

enter image description here

When i set price to filter between 90-100, the products whose price including tax is 103 (i.e. > 100) are also shown in the result. the price in the layered navigation is not considering price including tax

Can anyone tell me how to implement the solution ?

Thanks in advance.

Best Answer

This issue exists in Magento, For more information.

rewrite this file.

<Vendor>/<Module>/Model/ResourceModel/Product/Indexer/Price/Configurable.php

protected function _applyConfigurableOption()
...
        $select->columns(
            [
                'min_price' => new \Zend_Db_Expr('io.min_price'),
                'max_price' => new \Zend_Db_Expr('io.max_price'),
                'tier_price' => 'io.tier_price',
                /*'min_price' => new \Zend_Db_Expr('i.min_price - i.orig_price + io.min_price'),
                'max_price' => new \Zend_Db_Expr('i.max_price - i.orig_price + io.max_price'),
                'tier_price' => 'io.tier_price',*/
            ]
        );
...

For more information, please see #7367

Related Topic