0

Anyone knows where this + prefix symbol in customizable options is coming from?

customizable options plus symbol

I'd like to replace it with something like "for {price}". I searched all over Magento modules and couldn't find it.

It appears in product page, cart, minicart... etc.

Any help would be much appreciated.


Edit:

I was on the trail of finding the source of the symbol and I came by "/vendor/magento/module-checkout/view/frontend/web/template/minicart/item/default.html".

Inside it was this block of code:

<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: $parents[1].getOptionValueUnsanitizedHtml(option.value.join('<br/>'))"></span>
                        <!-- /ko -->
                        <!-- ko if: (!Array.isArray(option.value) && ['file', 'html'].includes(option.option_type)) -->
                            <span data-bind="html: $parents[1].getOptionValueUnsanitizedHtml(option.value)"></span>
                        <!-- /ko -->
                        <!-- ko if: (!Array.isArray(option.value) && !['file', 'html'].includes(option.option_type)) -->
                        <span data-bind="text: option.value"></span>
                        <!-- /ko -->
                    </dd>
                    <!-- /ko -->
                </dl>
            </div>

The title + price comes from <span data-bind="text: option.value"></span>. Apparently, this is bound via knockoutJS to "/vendor/magento/module-checkout/CustomerData/DefaultItem.php" with this:

protected function getOptionList()
{
    return $this->configurationPool->getByProductType($this->item->getProductType())->getOptions($this->item);
}

No idea what this getOptions is... Since I just wanted to get it over with already, i made a simple module with the file, did a str_replace on the return ('+' to 'only') and it worked.

Any better way to do it though?

1 Answer 1

1

You can check in the vendor file path

/vendor/magento/module-catalog/Block/Product/View/Options/AbstractOptions.php

Here _formatPrice() function has a $sign='+' variable, you can overwrite this file and change the symbol.

1
  • Hey, I've tried this, yet it still shows that pesky '+'. Could it be that it may be coming from somewhere else as well? I do have a minicart extension, but disabling it didn't remove it, so I guess it's not it.
    – kray
    Nov 12, 2022 at 15:14

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.