I am trying to get Product price by customer group. Used below code.

$sku = 123;
$customerGroup = $this->getCustomerGroupId();
$currentProduct = $this->loadProduct($sku);
$productPrice = $currentProduct->getPrice();

 public function loadProduct($sku)
    return $this->productRepository->get($sku);

public function getCustomerGroupId(){
    if ($this->customerSession->isLoggedIn()) {
        $customerGroup = $this->customerSession->getCustomer()->getGroupId();
        return $customerGroup;

Above code returning the product final price.

Can we get product price by customer Group code?


is returing the current customer group that is id = 5 in my case. How to get the product price from customer group?

Can anyone look into this and update me your ideas. Thanks


Try this one but don't use ObjectManager, you can inject Magento\Catalog\Model\Product & \Magento\Customer\Api\GroupRepositoryInterface class in constructor:

$productId = 9;//your product id here

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$_product = $objectManager->create('Magento\Catalog\Model\Product')->load($productId);

$productAllTierPrices = $_product->getData('tier_price');

$allTierPrices = array();
foreach($productAllTierPrices as $tierPrices){
    $groupname = $objectManager->create('\Magento\Customer\Api\GroupRepositoryInterface')-> getById($customerGroupId)->getCustomerGroupCode();
    $allTierPrices[$groupname] = $tierPrices['price'];

echo "<pre>";
  • Please provide solution as per class constructor Feb 27 '19 at 14:56
  • @groy, I have already customer group id, from that how can i get the product price,? Feb 27 '19 at 14:57
  • @jafarpinjar: Code updated with respect to customerGroupId.
    – groy
    Feb 27 '19 at 15:10
  • @groy, tried your answer, page not working error i am getting !! Feb 27 '19 at 15:13
  • @groy, I think ->getById($customerGroupId)->getCustomerGroupCode(); may be the error Feb 27 '19 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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