I am working on some code that makes a call to some azure functions that sync product data to our CRM / Inventory system. One thing that magento does when an admin user makes a change to a configurable product and saves it is that it fires the save event for the configurable product, as well as all of the child products.

We have configurable products AND simple single products in our store. I want to avoid making 5 or more calls per product by consolidating the json.

Long story short, is there any built-in way to get if a product is part of a configurable product, and also, is there a way to get if a product is NOT part of a configurable.

My goal is to load all the children of the configurable, combine the json, and make one call to Azure. At the same time I still want those single simple products that aren't configurable to still be able to send.

For instance, I can't filter on $product->getTypeId() !="configurable" or something like that.

FYI I'm using PhpStorm + xdebug to get the job done.

The data I was looking for is found here in this link. Its not the same question though.

Magento 2.0 Get POST data inside Productsaveafter Observer


If you want a way out thats faster execution.Then I suggest add an attribute that is configured so that it populates in flat catalog product table. Here name this attribute as is_configurable and for all configurable set it to one(manually or by some cron that checks and sets the flag).

Now you can just get to know whether product is configurable or not by doing an attribute check.

| improve this answer | |

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.