I have a problem with the prefix field.

I have set it to be optional and I added two values in "Prefix Dropdown Options": Mr;Mrs.

Everything it's correct except from the first option of the generated select, which is empty.

Here is the code:

<div class="select select__wrapper">
  <select class="select" data-bind="
    attr: {
        name: inputName,
        id: uid,
        disabled: disabled,
        'aria-describedby': getDescriptionId(),
        'aria-required': required,
        'aria-invalid': error() ? true : 'false',
        placeholder: placeholder
    hasFocus: focused,
    optgroup: options,
    value: value,
    optionsCaption: caption,
    optionsValue: 'value',
    optionsText: 'label',
    optionsAfterRender: function(option, item) {
        if (item &amp;&amp; item.disabled) {
            ko.applyBindingsToNode(option, {attr: {disabled: true}}, item);
    }" name="prefix" id="SO7RWP3" aria-invalid="false">
    <option data-title="" value=" "></option>
    <option data-title="Mr" value="Mr">Mr</option>
    <option data-title="Mrs" value="Mrs">Mrs</option>

Any ideas on how to add a translation for the first option like "Select a prefix"? Thanks

2 Answers 2


I am not sure that I got what You want, but it seems that its enough to change

<option data-title="" value=" "></option>


<option data-title="" value=" ">Select a prefix</option>


In that case look into:


there is function getNameSuffixOptions that calls prepareNamePrefixSuffixOptions there is :

$result = array_merge([' ' => ' '], $result);

that create empty value.
Override getNameSuffixOptions function or use di after, to change this value to Select a prefix.


Applying for checkout file is in deferent module

Override using preference in di.xml and


apply logic in line 142-150

foreach ($options as $value) {
        $value = $this->escaper->escapeHtml(trim($value));
        if($i===0) {
            $result[' '] = ' ';
        $result[$value] = $value;

It works fine for me!!

Happy Coding!!

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.