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.


<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 -->
            <!-- /ko -->

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.