Skip to content

Commit 838dc60

Browse files
committed
AC-8964::ConfigurableProduct Stock status
1 parent 6a5060a commit 838dc60

File tree

1 file changed

+11
-2
lines changed
  • app/code/Magento/ConfigurableProductGraphQl/Model/Wishlist

1 file changed

+11
-2
lines changed

app/code/Magento/ConfigurableProductGraphQl/Model/Wishlist/ChildSku.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff 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 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+
}
4251
}
4352
}

0 commit comments

Comments
 (0)