File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
app/code/Magento/Swatches/Model/Plugin Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -130,9 +130,17 @@ protected function setProperOptionsArray(Attribute $attribute)
130
130
$ swatchesArray = $ attribute ->getData ('swatchtext ' );
131
131
}
132
132
if ($ canReplace == true ) {
133
- $ attribute ->setData ('option ' , $ optionsArray );
134
- $ attribute ->setData ('default ' , $ defaultValue );
135
- $ attribute ->setData ('swatch ' , $ swatchesArray );
133
+ if (!empty ($ optionsArray )) {
134
+ $ attribute ->setData ('option ' , $ optionsArray );
135
+ }
136
+ if (!empty ($ defaultValue )) {
137
+ $ attribute ->setData ('default ' , $ defaultValue );
138
+ } else {
139
+ $ attribute ->setData ('default ' , [0 => $ attribute ->getDefaultValue ()]);
140
+ }
141
+ if (!empty ($ swatchesArray )) {
142
+ $ attribute ->setData ('swatch ' , $ swatchesArray );
143
+ }
136
144
}
137
145
}
138
146
You can’t perform that action at this time.
0 commit comments