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 cf81282 commit acead1eCopy full SHA for acead1e
app/code/Magento/Catalog/Model/Product.php
@@ -1909,10 +1909,12 @@ public function addOption(Product\Option $option)
1909
*/
1910
public function getOptionById($optionId)
1911
{
1912
- /** @var \Magento\Catalog\Model\Product\Option $option */
1913
- foreach ($this->getOptions() as $option) {
1914
- if ($option->getId() == $optionId) {
1915
- return $option;
+ if (is_array($this->getOptions())) {
+ /** @var \Magento\Catalog\Model\Product\Option $option */
+ foreach ($this->getOptions() as $option) {
+ if ($option->getId() == $optionId) {
1916
+ return $option;
1917
+ }
1918
}
1919
1920
0 commit comments