1

Anyone has idea how to make preference or plugin on Magento\ConfigurableProduct\Pricing\Render\FinalPriceBox class of Magento\ConfigurableProduct.

Basically, new function i wanted to add in the FinalPriceBox class and to use new function in final_price.phtml file.

I see code in the di.xml of module-configurableproduct module. But do not know how to use in new custom module?

<type name="Magento\ConfigurableProduct\Pricing\Price\FinalPrice">
        <arguments>
            <argument name="priceResolver" xsi:type="object">ConfigurableFinalPriceResolver</argument>
        </arguments>
    </type>
0
<type name="Magento\ConfigurableProduct\Pricing\Price\FinalPrice">
        <arguments>
            <argument name="priceResolver" xsi:type="object">ConfigurableFinalPriceResolver</argument>
        </arguments>
    </type>

Mean using di.xml magento is changing priceResolver parameter value of Magento\ConfigurableProduct\Pricing\Price\FinalPrice from PriceResolverInterface $priceResolver to ConfigurableFinalPriceResolver $priceResolve

So,You will use preference to add a method then you have to use below code at di.xml

<type name="{YournewRwriteClass}">
    <arguments>
        <argument name="priceResolver" xsi:type="object">ConfigurableFinalPriceResolver</argument>
    </arguments>
</type>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.