Simple one but cant find it. How do i display quantity of a product for a group only (wholesale)?
Thanks!
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communitySimple one but cant find it. How do i display quantity of a product for a group only (wholesale)?
Thanks!
You can try below code.
$customerSession = Mage::getSingleton('customer/session');
if($customerSession->isLoggedIn()){
$groupId = $customerSession->getCustomerGroupId();
$group = Mage::getModel('customer/group')->load($groupId);
if ('wholesale' == $group->getCode()){ //or $group->getCustomerGroupCode()
$qty = (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty();
echo 'Available quantity is ' . $qty;
}
}