Question

I have a custom module in my product page which allows customers to ask them notify them when an out of stock product size comes back in stock. I want to get out of stock product size swatches on a custom form inside a modal in product page but Im not able to get the swatches when I add block in layout.

 <block class="Magento\Framework\View\Element\Template" name="custom-modal" template="Vendor_module::custom-modal.phtml" >

                <block class="Magento\Swatches\Block\Product\Renderer\Configurable" name="product.info.options.swatches_inside_modal"   />


            </block>

How can I get out of stock product size swatches inside my custom-modal.phtml?

Was it helpful?

Solution

Found the Answer

Add appropriate block in your Product page

<block class="Magento\Swatches\Block\Product\Renderer\Listing\Configurable" name="product.info.options.swatches_inside_modal" template="Magento_Swatches::product/view/renderer.phtml"  />

Then call the html in the Phtml

<?= $this->getChildHtml('product.info.options.swatches_inside_modal') ?>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top