File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
app/code/Magento/ConfigurableProductGraphQl/Model/Wishlist Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -36,8 +36,17 @@ public function resolve(
36
36
37
37
/** @var Product $product */
38
38
$ product = $ value ['model ' ];
39
- $ optionProduct = $ product ->getCustomOption ('simple_product ' )->getProduct ();
40
39
41
- return $ optionProduct ->getSku ();
40
+ /** to handle no child sku selected at add to whishlist time */
41
+ $ optionsArray = json_decode ($ product ->getCustomOption ('info_buyRequest ' )->getValue (), true );
42
+ $ superAttribute = $ optionsArray ['super_attribute ' ];
43
+ $ totalSelected = array_filter ($ superAttribute );
44
+
45
+ if (count ($ totalSelected ) > 0 ) {
46
+ $ optionProduct = $ product ->getCustomOption ('simple_product ' )->getProduct ();
47
+ return $ optionProduct ->getSku ();
48
+ } else {
49
+ return "" ;
50
+ }
42
51
}
43
52
}
You can’t perform that action at this time.
0 commit comments