I try to add Size Chart block on product view page in Magento 2. I add this code in catalog_product_view.xml
<referenceContainer name="product.info.main">
<block class="Magento\Catalog\Block\Product\View\Attributes" name="sizechart" template="product/view/sizechart.phtml"/>
</referenceContainer>
and this in the sizechart.phtml
<?php
$_helper = $this->helper('Magento\Catalog\Helper\Output');
$_product = $block->getProduct();
?>
<?php if ($_product->getData('size_chart')): ?>
<a href="#">Size Chart</a>
<?php
echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId($_product->getAttributeText('size_chart'))->toHtml();?>
<?php endif; ?>
Everything is okay for the simple products, but when I open a configurable product the size chart block in not displayed anymore.
What is the problem?
Thanks