0

I want available stock Qty to be displayed right underneath of the home page and quick view like I have marked on,what would be the easiest approach to achieve this?
(I use an advanced warehouse module to maintain 25 different store views at particular locations[Amasty Advanced Inventory])

Home page Quick view

1

1 Answer 1

2

to Show quantity on listing page and quick show pop you there are 2 methods either create your custom module and call its block on both places or add code directly using $ObjectManager.

This method is not recommended but since you need some quick and easy solution that is why I am giving it here :

<?php
    $ObjectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $StockState = $ObjectManager->get('\Magento\CatalogInventory\Api\StockStateInterface');

    echo $StockState->getStockQty($product->getId(), $product->getStore()->getWebsiteId());
 ?>

for adding on listing page Go to your theme folderMagento_Catalog/templates/product/list.phtml file and add below code where you want to show it i.e underneath product name etc.

Same you can add code to your theme's quick view template.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.