I want to get Sku for selected options.
Above image i have select blue and M. So this options product sku get in magento 2.
Please Help me.
THANKS.
You can try this code to get the sku of any product:
$configProduct = $objectManager->create('Magento\Catalog\Model\Product')->load($product_id);
$_children = $configProduct->getTypeInstance()->getUsedProducts($configProduct);
foreach ($_children as $child){
echo "Here are your child Product Ids ".$child->getID()."\n";
}
echo "count: ".count($_children);
But if you want to see the configurable product sku in frontend
Visit https://firebearstudio.com/blog/how-to-get-simple-products-of-configurable-product-in-magento-2.html