Magento2: Address update issue when using VAT id and automatic assignment to customer group.

Created on 18 Apr 2018  路  18Comments  路  Source: magento/magento2

Preconditions


  1. Magento CE 2.2.3
  2. PHP 7.0.2
  3. MySql 5.6
  4. Change Magento settings:
    Customers > Customer Configuration > Create New Account Options
    Enable Automatic Assignment to Customer Group > yes
    Tax Calculation Based On > Billing Address
    Default Group > General
    Group for Valid VAT ID - Domestic > Wholesale
    Group for Valid VAT ID - Intra-Union > General
    Group for Invalid VAT ID > Retailer
    Validation Error Group > Retailer
    Validate on Each Transaction > Yes
    Default Value for Disable Automatic Group Changes Based on VAT ID > No
    Show VAT Number on Storefront > Yes

Steps to reproduce

  1. Log in as a customer
  2. Go to "My Account" > "Address Book" > "Change Billing Address"
  3. Enter valid "VAT Number" and select appropriate country, save address
  4. Edit the same address again, enter new VAT Number from a different country, select the country, save.
  5. Messages appear:
    "Your VAT ID was successfully validated. You will not be charged tax."
    "You saved the address."

Expected result

  1. New VAT Number, country and all other address details are saved.

Actual result

  1. Despite success-messages new informaiton is not saved, custom attributes(if present) are removed.

Setting "Enable Automatic Assignment to Customer Group" to "no" fixes the problem.

Customer Fixed in 2.3.x Clear Description Format is valid

Most helpful comment

Is there any patch available for us to use in older versions? Please get back.

All 18 comments

version Magento ver. 2.2.1

We have the same problem, but we with some slight differences.
And we noticed that if you do the following the VAT-id is saved anyhow.

  1. Register as a customer without VAT-id
  2. Go to "My Account" > "Address Book" > "Change Billing Address"
  3. Enter valid "VAT Number" and select appropriate country, save address
  4. "Your VAT ID was successfully validated. You will not be charged tax."
    "You saved the address."

Result: VAT id is not saved in address book.

Solution follow these steps again:

  1. Go to "My Account" > "Address Book" > "Change Billing Address"
  2. VAT-ID value is empty
  3. Enter valid "VAT Number" and select appropriate country, save address

Then the VAT-Id is saved.

Same issues is on the backend you have to fill in the VAT-id twice and save twice then everything is saved. Or if you wanne remove the VAT-id the same issue is there, you have to empty the value twice and save twice.

It does look like the automatic customer group assignment or either the VAT-id validation is the startpoint of this issue.

Also replicated on 2.2.3

Hi @al1357 i cannot reproduce this on 2.2-develop branch, but randomly i was have the same result as your, can you try reproduce this on 2.2-develop branch ?

@al1357 we are closing this issue due to inactivity. If you'd like to update it, please reopen the issue.

Same issue can be seen in 2.2.3 as well.
I will tell the scenario. we do have retail and business customers. Changing customer group based on VAT ID is enabled in the site.
Once loggedIn and a business customer tries to checkout, the VAT should turn zero since for business customers, only UK got VAT(according to our site rules)
But when we try, its always adding VAT also. But whenever we disable the automatic change of customer group for that customer in customer edit page(admin), we can see its applying fine.
This is a bug, since in Magento 1 its working fine.
Please reopen this issue.

Hi @shyam100379 Ok. i'm try again with you scenario

the bug is there for sure, i have tried different scenarios and its there.

@ engcom-backlog-nazar Did you tried the scenario i mentioned?

@shyam100379 Yes but i'm not able to reproduce on 2.2-dev branch.

But i have tried it again in our site and still the issue persists.
The version we have is: Magento ver. 2.2.3

Did you got time to check? The issue is there for sure. Can you please check again. Thanks.

We are still experiencing this issue on 2.2.4.

Our default 'customer' config is:
Validate on Each Transaction -> YES
Default Value for Disable Automatic Group Changes Based on VAT ID - NO

@shyam100379 what settings do you have there?

Hi @engcom-backlog-nazar. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [x] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [x] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 6. Add label Issue: Confirmed once verification is complete.

  • [ ] 7. Make sure that automatic system confirms that report has been added to the backlog.

We are still experiencing this issue on 2.2.4.

Our default 'customer' config is:
Validate on Each Transaction -> YES
Default Value for Disable Automatic Group Changes Based on VAT ID - NO

@shyam100379 what settings do you have there?

Changing the value 'Default Value for Disable Automatic Group Changes Based on VAT ID' to YES doesn't effect the expected result.

Having tested this multiple times i'm pretty sure the following happends in this function.

Actual result:
Check VAT-ID based on inputfield
Get VAT check result and save customer in corresponding group
Leaving adress data including the vat-id untouched.

Expected result
Save all new shipping/billing adress data based on inputfields
Check VAT-ID
Set customer in corresponding group

Saving the adress data just doens't happend when there is a change of customer group.
There for you have to save it twice.
1st time to set the customer in the right customer group (eg. Intra-EU)
As the customer is in the right customer group
You can put in the address and vat data again and save it for the
2nd time to save the address and vat-id data.

Hi @al1357 thank you for you report, The issue was re-tested and we can confirm that it was fixed on the 2.3 release branch. We closing this issue as fixed due to upcoming 2.3 release that will be available soon.

Hello @engcom-backlog-nazar
I am facing the same issue in my site, and need solution for it. So can you please tell me from were I could get the final solution or code.

Is there any patch available for us to use in older versions? Please get back.

Hello,

We have the same issue on 2.3.0

In "My Account" > "Address Book" > "Change Billing Address", when there is a Customer Group Change (because we have added/removed VAT Number) the Address is not saved.
We have to re-enter it to get it saved correctly.

Thanks

Was this page helpful?
0 / 5 - 0 ratings