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(
3636
3737 /** @var Product $product */
3838 $ product = $ value ['model ' ];
39- $ optionProduct = $ product ->getCustomOption ('simple_product ' )->getProduct ();
4039
41- return $ optionProduct ->getSku ();
40+ /** to handle no child sku selected at add to wishlist 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+ }
4251 }
4352}
You can’t perform that action at this time.
0 commit comments