We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent af9ab20 commit 2f79a06Copy full SHA for 2f79a06
app/code/Magento/Catalog/Model/Product.php
@@ -1886,8 +1886,10 @@ public function toArray(array $arrAttributes = [])
1886
{
1887
$data = parent::toArray($arrAttributes);
1888
$stock = $this->getStockItem();
1889
- if ($stock) {
+ if (is_object($stock) && method_exists($stock, 'toArray')) {
1890
$data['stock_item'] = $stock->toArray();
1891
+ } elseif (is_array($stock)) {
1892
+ $data['stock_item'] = $stock;
1893
}
1894
unset($data['stock_item']['product']);
1895
return $data;
0 commit comments