I make a dynamic quantity in a custom product and I need to get the product by id.
My class in my module:
class Item extends \Magento\CatalogInventory\Model\Stock\Item { public function getQty() { $_product = $objectManager->get('Magento\Catalog\Model\Product')->load($productId); $attr = $_product->getData('attribute_name'); return 123; } }
But after calling "load" magenta freezes. This is because in the method of load caused by my method, and there is begins recursion.
How can I get my attribute?
Same problem here. Did you find any solutions ?
Yes. I created my code with sql-commands and didn't use the repository or model.