Pergunta

Is there a way to remove my custom attribute code and only show the value?

I created a custom address attribute "special_instructions" and when I add an address in my account section everything works fine.. but when I add an address in the checkout the address summary shows my attribute code and the value.

What can I do?

m

Foi útil?

Solução

Below code snippet is responsible for rendering the custom address attributes:

<each args="data: address().customAttributes, as: 'element'">
    <each args="data: Object.keys(element), as: 'attribute'">
        <if args="typeof element[attribute] === 'object'">
            <if args="element[attribute].label">
                <text args="element[attribute].label"/>
            </if>
            <ifnot args="element[attribute].label">
                <if args="element[attribute].value">
                    <text args="element[attribute].value"/>
                </if>
            </ifnot>
        </if>
        <if args="typeof element[attribute] === 'string'">
            <text args="element[attribute]"/>
        </if><br/>
    </each>
</each>

As you can see, it checks whether the attribute has a label property. if yes, it will show the label. Otherwise, it will show the value property.

So I assume you don't have the label property for your custom address attribute.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange
scroll top