vendor/magento/module-catalog/Block/Product/View/Options.php
/**
* Get json representation of
*
* @return string
*/
public function getJsonConfig()
{
$config = [];
foreach ($this->getOptions() as $option) {
/* @var $option \Magento\Catalog\Model\Product\Option */
if ($option->hasValues()) {
$tmpPriceValues = [];
foreach ($option->getValues() as $valueId => $value) {
$tmpPriceValues[$valueId] = $this->_getPriceConfiguration($value);
}
$priceValue = $tmpPriceValues;
} else {
$priceValue = $this->_getPriceConfiguration($option);
}
$config[$option->getId()] = $priceValue;
}
$configObj = new \Magento\Framework\DataObject(
[
'config' => $config,
]
);
//pass the return array encapsulated in an object for the other modules to be able to alter it eg: weee
$this->_eventManager->dispatch('catalog_product_option_price_configuration_after', ['configObj' => $configObj]);
$config=$configObj->getConfig();
return $this->_jsonEncoder->encode($config);
}
In your case $option->getValues() returns null, this should retuns array. So quick fix is:
/**
* Get json representation of
*
* @return string
*/
public function getJsonConfig()
{
$config = [];
foreach ($this->getOptions() as $option) {
/* @var $option \Magento\Catalog\Model\Product\Option */
if ($option->hasValues()) {
$tmpPriceValues = [];
if (is_array($option->getValues())) {
foreach ($option->getValues() as $valueId => $value) {
$tmpPriceValues[$valueId] = $this->_getPriceConfiguration($value);
}
}
$priceValue = $tmpPriceValues;
} else {
$priceValue = $this->_getPriceConfiguration($option);
}
$config[$option->getId()] = $priceValue;
}
$configObj = new \Magento\Framework\DataObject(
[
'config' => $config,
]
);
//pass the return array encapsulated in an object for the other modules to be able to alter it eg: weee
$this->_eventManager->dispatch('catalog_product_option_price_configuration_after', ['configObj' => $configObj]);
$config=$configObj->getConfig();
return $this->_jsonEncoder->encode($config);
}
Note: Overwrite this class. Don't modify the core file