Skip to content

registry

Auto Added by WPeMatico

In magento 2 javascript , How i can wait till a component/node initialize then i can excute my code?

How to wait till components exists in registry . I want to wait till global component “messages” initialize then I can add error/success message. // view/frontend/templates/messages.phtml <script type=”text/x-magento-init”> { “*”: { “Magento_Ui/js/core/app”: { “components”: { “messages”: { “component”: “Magento_Theme/js/view/messages” }… Read More »In magento 2 javascript , How i can wait till a component/node initialize then i can excute my code?

Registry & Services

Can Any body explain me Why Magneto used registry and now why we use Services for what purposes instead of Registry.

Getting the minimum qty allowed in a shopping cart without deprecated methods

Previously to get the minimum qty allowed in a shopping cart I would use the following code: public function __construct( MagentoCatalogInventoryApiStockRegistryInterface $stockRegistry ){ $this->stockRegistry = $stockRegistry; } public function getMinSaleQtyAllowed($productId): float { $stockItem = $this->stockRegistry->getStockItem($productId); return $stockItem->getMinSaleQty(); } However, MagentoCatalogInventoryApiStockRegistryInterface… Read More »Getting the minimum qty allowed in a shopping cart without deprecated methods