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

1
  • Please add your custom address attribute related code. This will definitely help you to sort out the issue Oct 5, 2019 at 4:32

1 Answer 1

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.

1

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.