How to add body class before rendering the page in Magento 2?

Magento 2 add body class with pages like cms, category, product and checkout page.

You can set cutom body class for the page in Magento 2 using plugin by Magento\Framework\View\Result\Page class. Continue reading “How to add body class before rendering the page in Magento 2?”

How to check Product has custom options in Magento 2?

You can check if a product has a custom option exists (hasOptions()) or not in Magento 2 by Product Object.

Some product type contains options like Bundle and Configurable while Simple, Virtual, Grouped, Downloadable and gift card doesn’t support options. Continue reading “How to check Product has custom options in Magento 2?”

Get all Children items of Bundle Products Magento 2.

How to Get Bundle Product children in Magento 2 By Parent Id?

Bundle Product is generated from multiple simple or virtual product combinations in Magento 2.

You can get all the children items of bundle product by an interface, Magento\Bundle\Api\ProductLinkManagementInterface Continue reading “Get all Children items of Bundle Products Magento 2.”