0

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

  • Please add your custom address attribute related code. This will definitely help you to sort out the issue – Rajeev K Tomy Oct 5 '19 at 4:32
1

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.