@@ -287,9 +287,9 @@ public function setData($key, $value = null)
287
287
} elseif (is_array ($ value ) && $ this ->isAddressMultilineAttribute ($ key )) {
288
288
$ value = $ this ->_implodeArrayValues ($ value );
289
289
} elseif (self ::CUSTOM_ATTRIBUTES === $ key && is_array ($ value )) {
290
- foreach ( $ value as & $ attribute ) {
291
- $ attribute = is_array ( $ attribute ) ? $ attribute : $ attribute -> __toArray ();
292
- $ attribute = $ this ->processCustomAttribute ($ attribute );
290
+ $ value = $ this -> filterCustomAttributes ([ self :: CUSTOM_ATTRIBUTES => $ value ])[ self :: CUSTOM_ATTRIBUTES ];
291
+ foreach ( $ value as $ attribute) {
292
+ $ this ->processCustomAttribute ($ attribute );
293
293
}
294
294
}
295
295
@@ -724,22 +724,16 @@ protected function isFaxRequired()
724
724
}
725
725
726
726
/**
727
- * Unify attribute format.
727
+ * Normalize custom attribute value
728
728
*
729
- * @param array $attribute
730
- * @return array
729
+ * @param \Magento\Framework\Api\AttributeInterface $attribute
730
+ * @return void
731
731
*/
732
- private function processCustomAttribute (array $ attribute ): array
732
+ private function processCustomAttribute (\ Magento \ Framework \ Api \ AttributeInterface $ attribute ): void
733
733
{
734
- if (isset ($ attribute ['attribute_code ' ]) &&
735
- isset ($ attribute ['value ' ]) &&
736
- is_array ($ attribute ['value ' ]) &&
737
- $ this ->isAddressMultilineAttribute ($ attribute ['attribute_code ' ])
738
- ) {
739
- $ attribute ['value ' ] = $ this ->_implodeArrayValues ($ attribute ['value ' ]);
734
+ if (is_array ($ attribute ->getValue ()) && $ this ->isAddressMultilineAttribute ($ attribute ->getAttributeCode ())) {
735
+ $ attribute ->setValue ($ this ->_implodeArrayValues ($ attribute ->getValue ()));
740
736
}
741
-
742
- return $ attribute ;
743
737
}
744
738
745
739
/**
0 commit comments