Skip to content

Call to a member function isSaleable error

After I updated my Magento I got this error and it caused some issues like Ad to cart etc.

An error message is:

#130 {main} {“exception”:”[object] (Error(code: 0): Call to a member function isSaleable() on null at /chroot/home/ab140e0b/6e29c5a329.nxcli.io/html/app/code/KraftMedia/GroupedProduct/view/frontend/templates/product/view/addtocart.phtml:7)”} []

The code the error is referring to:

<?php if ($_product->isSaleable() && $viewModel->canShowAddToCart($_product)) :?>

shouldRenderQuantity()) :?>

escapeHtml(__(‘Qty’)) ?>

getProductDefaultQty() * 1 ?>”
title=”escapeHtmlAttr(__(‘Qty’)) ?>”
class=”input-text qty”
data-validate=”escapeHtml(json_encode($block->getQuantityValidators())) ?>”
/>

This module stops customers from buying grouped products if 1 of the products is out of stock.

Is this possible to this in Magento out of box now, or do we need to fix this error? And do anyone know how to fix this issue?