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"   />


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

1 Answer 1


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') ?>

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.