How to Set Product final price using catalog_product_get_final_price Event in Magento 2.

You can modify the final price value by define events in your XML file with Magento 2.

catalog_product_get_final_price event defined under the Magento\Catalog\Model\Product\Type\Price class.

Refer the GetFinalPrice() method from the Price.php class which defined the event to modify the final price value of the product.

If you are working with the REST or SOAP API, You need to define events in the webapi_rest or webapi_soap area of the module to trigger events.

Let’s take a simple example to set Product price as Maximum 100.
We have created an observer to fetch product final price and we are checking if the product price is greater than 100, we set it to max 100 by observer class.

Define Events in your module front area, etc/frontend/events.xml

Create an Observer file to trigger event action to set the final price,

In this Example, We are setting the maximum price to be 100, if the price of a product is greater than 100 then it will set automatically to 100 and the product price is below 100 then it will be displayed that price.

You can set your logic to the observer file based on your requirements. In the Observer file, You get the product Object data and Product Qty value.