

@FerihumF thank you for your feedback.
Please, format this issue according to the Issue reporting guidelines: with steps to reproduce, actual result and expected result.
I see that all necessary information is already present but it is much easier to read and understand the issue when it is well-formatted.
@veloraven
thank you, updated the issue.
Hi @FerihumF, thanks for report but I cannot reproduce issue.
Can you reproduce it on clean Magento without any custom modules or theme?
Hi @FerihumF
I am getting the same kind of issue. If your issue resolved could you please help me.
Hi, guys!
The problem is, Magento for some reason hasn't set up the customer group id for the simple product correctly.
This is a quick fix that you can apply, until Magento devs solve this:
You need to change the file vendor/magento/module-catalog/Model/Product/Type/Price.php
From:
/**
* @param Product $product
* @return int
*/
protected function _getCustomerGroupId($product)
{
if ($product->getCustomerGroupId() !== null) {
return $product->getCustomerGroupId();
}
return $this->_customerSession->getCustomerGroupId();
}
To:
```
/**
* @param Product $product
* @return int
*/
protected function _getCustomerGroupId($product)
{
if($this->_customerSession->isLoggedIn() && $this->_customerSession->getCustomerGroupId() != $product->getCustomerGroupId())
$product->setCustomerGroupId($this->_customerSession->getCustomerGroupId());
if ($product->getCustomerGroupId() !== null) {
return $product->getCustomerGroupId();
}
return $this->_customerSession->getCustomerGroupId();
}
```
@FerihumF, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.
Hi,
I allow myself to reopen this issue.
I encounter the same problem on Magento v2.2.2 and PHP 7.0
Tier price display good on product page but when I put article in cart, the price is base price.
I note that the customer group id in session is lose when I put my product in cart.
When I display session data for the session after cart, it take the default group id for my customer.
Is anyone enconter same issue?
I tried the @renatolovato renatolovato quick fix but it dosen't fix the problem for me.
Please help
Thanks
Having this issue on Magento 2.2.2 and PHP 7.0
Seems to be a bug :(
Had the same issue with Magento 2.1.12 and PHP 7.0
The fix renatolovato proposed fixed this issue.
For me it was due to a third party extension. I removed that extension and now it is fixed.
I had the same issue with Magento 2.1.7.
No third party extension.
Also i confirm that the fix from @renatolovato is working great. THANK YOU.
@damien-lechopier I'm still having this bug too .. Magento 2.2.4 .. the "fix" partially works if I force it to return the wholesaler group, and as long as I don't change anything in the estimator, it "looks" fine, but as soon as it recalculates, it does the exact same thing as yours - it loses the logged in customer's group. Does anyone know what route the recalculation of the totals uses?
@webspeaks Hi webspeaks, which 3rd party extension did you remove by chance?
Hi guys .. FYI, I'm a lot closer now. The problem is in another getCustomerGroupId .. in /vendor/magento/module-quote/Model/Quote.php .. this is where it goes every time there's an update to the quote.
Just to test it, I commented out the following:
/* if ($this->hasData('customer_group_id')) {
return $this->getData('customer_group_id');
} elseif ($this->getCustomerId()) {
return $this->getCustomer()->getGroupId();
} else {
return GroupInterface::NOT_LOGGED_IN_ID;
}
*/
and returned 3 which is my customer group that I want, and it worked. Now .. why is it failing the first 2 if statements and why is it setting the session customer group to the default? Thoughts?
Sorry .. one more thing I noticed, it is setting the customer group immediately after adding it to the cart, so it's not even the quote that's setting customer group id.
Hi .. I did some more debugging on /vendor/magento/module-quote/Model/Quote.php ... getCustomerGroupId
This function gets called numerous times. Here is some detail about what methods are calling it. I had 3 items in my cart at the time:
main.INFO: Group id: 3 called by addTierPriceData - from /vendor/magento/module-quote/Model/ResourceModel/Quote/Item/Collection.php [] []
main.INFO: Group id: 3 called by setProduct - from /vendor/magento/module-quote/Model/ResourceModel/Quote/Item/Collection.php [] []
main.INFO: Group id: 3 called by setProduct - from /vendor/magento/module-quote/Model/ResourceModel/Quote/Item/Collection.php [] []
main.INFO: Group id: 3 called by setProduct - from /vendor/magento/module-quote/Model/ResourceModel/Quote/Item/Collection.php [] []
main.INFO: Group id: 3 called by execute - from /vendor/magento/framework/Event/Invoker/InvokerDefault.php [] []
_And the next return is different:_
main.INFO: Group id: 2 called by _initItem - from /vendor/magento/module-quote/Model/Quote/Address/Total/Subtotal.php [] []
main.INFO: Group id: 2 called by _initItem - from /vendor/magento/module-quote/Model/Quote/Address/Total/Subtotal.php [] []
main.INFO: Group id: 2 called by _initItem - from /vendor/magento/module-quote/Model/Quote/Address/Total/Subtotal.php [] []
I haven't looked further yet but what I did is replace the existing function with the following (pulling the session in first and then getting the customer id:
$this->_customerSession=\Magento\Framework\App\ObjectManager::getInstance()->get('\Magento\Customer\Model\Session');
return $this->_customerSession->getCustomer()->getGroupId();
That's when it finally started working!!! Hope that helps someone and if you can figure out why execute method seems to be changing the customer group id, please share (I verified, it's the same customer id throughout all the calls, just the group id changes).
getCustomerGroupId
Hello @jvhost,
In order to fix the issue, try this method, you need to configure "Disable Automatic Group Change Based on VAT ID" to Yes for the customer.
But normally this should not be the case. I tried a fresh install of Magento 2.3.1 and it works fine without doing this method. So I think something like a third party extension or any.

There's also a configuration for this one that upon user registration it will automatically disable that setting

Thanks!
MazeStricks
.
Disabling Automatic Group Changes fixed it for me.
for me none of the alternatives worked. Magento 2.3.5-p1
Most helpful comment
Hi, guys!
The problem is, Magento for some reason hasn't set up the customer group id for the simple product correctly.
This is a quick fix that you can apply, until Magento devs solve this:
You need to change the file vendor/magento/module-catalog/Model/Product/Type/Price.php
From:
To:
```
/**
* @param Product $product
* @return int
*/
protected function _getCustomerGroupId($product)
{
if($this->_customerSession->isLoggedIn() && $this->_customerSession->getCustomerGroupId() != $product->getCustomerGroupId())
$product->setCustomerGroupId($this->_customerSession->getCustomerGroupId());
```