0

I use HTML Code inside Custom Options. The Radio Option titles are for example

<p class="style1">Option1</p>

This way I can style my custom options in css, instead just plain text.

Minicart does not render the html, it just shows the html code above.

The code below comes from : U see Knockout js is parsing with html but it still returns text. I need the option.value to be decoded so it displays rendered html.
I tried JavaScript solutions and it didn't work.

public_html/vendor/magento/module-checkout/view/frontend/web/template/minicart/item/default.html

<div class="product options" data-mage-init='{"collapsible":{"openedState": "active", "saveState": false}}'>
    <span data-role="title" class="toggle"><!-- ko i18n: 'See Details' --><!-- /ko --></span>
    <div data-role="content" class="content">
        <strong class="subtitle"><!-- ko i18n: 'Options Details' --><!-- /ko --></strong>
        <dl class="product options list">
            <!-- ko foreach: { data: options, as: 'option' } -->
            <dt class="label"><!-- ko text: option.label --><!-- /ko --></dt>
            <dd class="values">
                <!-- ko if: Array.isArray(option.value) -->
                    <span data-bind="html: option.value.join('<br>')"></span>
                <!-- /ko -->
                <!-- ko ifnot: Array.isArray(option.value) -->
               <span data-bind="html: option.value"></span>
                <!-- /ko -->
            </dd>
            <!-- /ko -->
        </dl>
    </div>
</div>

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.