I am trying to add a container div for each color of the swatch colors to give it the look I need (configurable product, in PDP). I am adding the div in the following file that I inserted in my theme ../Magento_Swatches/templates/layered/renderer.phtml

 case '1':
                        <div class="swatch-color-container">
                            <div class="swatch-option color <?= $block->escapeHtmlAttr($label['custom_style']) ?>"
                             option-id="<?= $block->escapeHtmlAttr($option) ?>"
                             option-label="<?= $block->escapeHtmlAttr($label['label']) ?>"
                             option-tooltip-value="<?= $block->escapeHtmlAttr($swatchData['swatches'][$option]['value']) ?>"
                             style="background: <?= $block->escapeHtmlAttr($swatchData['swatches'][$option]['value']) ?> no-repeat center; background-size: initial;"></div>
  • I'm trying to put this div in that code, but not working. it doesn't show me mistakes, but i can't see it. – Cristian Conesa Nov 28 '19 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.