Adding option to a product create error
I'm extending the \Magento\Catalog\Block\Product\View file in AddToCart.php.
In my AddTocart, I've added this line :
$stock = $this->isInStockCustom($sku);
Now, I'm adding options to my products. It was working find until now.
But if I add an option to this product, in my log, I have this
Invalid method Magento\Catalog\Block\Product\View\Interceptor::isInStockCustom [] []
But if I remove the options, I don't have this error anymore.
Any help would be very appreciated.
Solutions
Go it :
also need to change this in catalog_product_view.xml:
<block class="Vendor\Module\Block\AddToCart"
name="product.info.addtocart.additional" as="product.info.addtocart"
template="Magento_Catalog::product/view/addtocart.phtml"/>
Because additional option and simple product are not the same.