Skip to content

Loading Configurable options dynamically under Modal irrespect to Magento that initialize only on page load

I want to achieve loading along with Configurable variations/options (dropdown attribute size) under the Modal popup.

Rule is each type user click on some configurable under the custom list, will popup its options under the modal

I’m facing the complexity as magento only initialize this on page load only whereas, i want to populate the modal everytime with different product options.

<script type="text/x-magento-init">

{
“#product_addtocart_form”: {
“configurable”: {…}
}
}

I’m using the controller to fetch this information and than displaying it using the javascript.
block = $layout->createBlock(
MagentoCatalogBlockProductView::class
)->setProduct($product)
->setTemplate(‘Magento_Catalog::product/view/form.phtml’);

How to achieve this ?