Is there a way to get the SKU of the option of my product ?

Can't make anything works Tried this :

$customOptions = $objectManager->get('Magento\Catalog\Model\Product\Option')->getProductOptionCollection($_product);

foreach($customOptions as $optionKey => $optionVal):
               foreach($optionVal->getValues() as $valuesKey => $valuesVal) {
                      echo $valuesVal->getId().' '.$valuesVal->getTitle();

but $optionVal->getValues() is

Invalid argument supplied for foreach()

 of po


Try This :-

$productId = $_product->getId();
$customOptions = $obj->create('Magento\Catalog\Model\ProductRepository')->get($productId);
$productOption = $product->getOptions();
foreach($productOption as $option)
    print_r($option->getData()); //get All Data Of Option

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.