I want to override updateTemporaryTable() of Magento\ConfigurableProduct\Model\ResourceModel\Product\Indexer\Price\Configurable.php which is private method.

please help me in overriding private method.

2 Answers 2


I am not sure about this method but I will give it try:

I think you have to override and do changes in executeByDimensions() function.

Where you will call another function(your own function) having same properties of applyConfigurableOption() and disable calling core applyConfigurableOption() function.

Now in here you write all the same code as core function just change fillTemporaryOptionsTable() function calling code(disable core write you'r own one).



I can help you, but you have to remember: you shouldn't overwrite a private method in Magento.

You have to create di.xml in folder /etc in your module (app/code/YourCompany/YourModule/etc). In this file, you have to write this code:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\ConfigurableProduct\Model\ResourceModel\Product\Indexer\Price\Configurable" type="YourCompany\YourModule\Model\ResourceModel\Product\Indexer\Price\Configurable" />

Next, you have to create the class and in this class YourCompany\YourModule\Model\ResourceModel\Product\Indexer\Price\Configurable.php, you have create this method updateTemporaryTable().

declare (strict_type=1)
namespace YourCompany\YourModule\Model\ResourceModel\Product\Indexer\Price;

class Configurable
    private function updateTemporaryTable(string $temporaryPriceTableName, string $temporaryOptionsTableName)
        (your code)

If it'll be works let me know :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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