-1

I am trying to get custom option value (SKU) from Configure product custom option

$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();
                     //print_r($valuesVal->getData());
                     echo $valuesVal->getSku();
                }
endforeach;

but i can't get SKU..

Please assist me.

1

1 Answer 1

0

Please change the code as below

From:

echo $valuesVal->getSKU();

To:

echo $valuesVal->getSku();
3
  • not get anything .. blank
    – Bhavesh
    Commented Aug 9, 2020 at 9:47
  • What are you getting when write print_r($valuesVal->getData());? Commented Aug 9, 2020 at 10:17
  • I added new Filed in Custom option and get value, Thank You.
    – Bhavesh
    Commented Aug 11, 2020 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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