@@ -287,9 +287,9 @@ public function setData($key, $value = null)
287287 } elseif (is_array ($ value ) && $ this ->isAddressMultilineAttribute ($ key )) {
288288 $ value = $ this ->_implodeArrayValues ($ value );
289289 } 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 );
293293 }
294294 }
295295
@@ -724,22 +724,16 @@ protected function isFaxRequired()
724724 }
725725
726726 /**
727- * Unify attribute format.
727+ * Normalize custom attribute value
728728 *
729- * @param array $attribute
730- * @return array
729+ * @param \Magento\Framework\Api\AttributeInterface $attribute
730+ * @return void
731731 */
732- private function processCustomAttribute (array $ attribute ): array
732+ private function processCustomAttribute (\ Magento \ Framework \ Api \ AttributeInterface $ attribute ): void
733733 {
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 ()));
740736 }
741-
742- return $ attribute ;
743737 }
744738
745739 /**
0 commit comments