Is it possible to only change the price of products on the category page and not on the product page.
I tried the following but this changes the global product price and I only want to change it on the category page.
di.xml:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Catalog\Model\Product">
<plugin name="change_product" type=" Vendor\Module\Plugin\Product " sortOrder="1" disabled="true"/>
</type>
</config>
Plugin/Product.php:
class Product
{
public function afterGetPrice(\Magento\Catalog\Model\Product $subject, $result)
{
return $result + 100;
}
}
It's possible if you use XML layouts: Create a file in: app/code/Vendor/Module/view/frontend/catalog_category_view.xml.
And in this file you must point to your custom block class. At the moment a can't give more details, but it is tha way.