Skip to content

The vat rate is not applied correctly when the selected address is not in the same tax class as the customer's default address #38232

Open
@nicolaspernot

Description

@nicolaspernot

Preconditions and environment

  • Magento version : 2.4.5-p1

Steps to reproduce

  • Create a no-VAT Tax Rate for Belgium

    • BO > Stores > Tax Zones and Rates
      • Add new Tax Rate :
        • Tax Identifier : Exo TVA UE BE
        • Zip/Post is Range : not checked
        • Zip/Post Code : *
        • State : *
        • Country : Belgium
        • Rate Percent : 0.0000
        • Save Rate
  • Create a VAT Tax Rate for France and Belgium

    • BO > Stores > Tax Zones and Rates
      • Add new Tax Rate :
        • Tax Identifier : TVA France
        • Zip/Post is Range : not checked
        • Zip/Post Code : *
        • State : *
        • Country : France
        • Rate Percent : 20.0000
        • Save Rate
    • BO > Stores > Tax Zones and Rates
      • Add new Tax Rate :
        • Tax Identifier : TVA UE BE
        • Zip/Post is Range : not checked
        • Zip/Post Code : *
        • State : *
        • Country : Belgium
        • Rate Percent : 21.0000
        • Save Rate
  • Create a Tax Rule for no VAT :

    • BO > Stores > Tax Rules
      • Add new Tax Rule :
        • Name : Exo TVA
        • Tax Rate : Exo TVA UE BE
        • In additional Settings :
          • Customer Tax Class :
            • Add New Tax Class : Customer_UE_PRO
            • Select only Customer_UE_PRO, unselect other
        • Save Rule
  • Create a Tax Rule for VAT :

    • BO > Stores > Tax Rules
      • Add new Tax Rule :
        • Name : TVA
        • Tax Rate : TVA France, TVA UE BE
        • In additional Settings :
          • Customer Tax Class :
            • Add New Tax Class : Customer_TVA
            • Select only Customer_TVA
        • Save Rule
  • Create a Customer Group for no VAT Customers

    • BO > Customers > Customer Groups
      • Add New Customer Group
        • Group Name : EU_PRO
        • Tax Class : Customer_UE_PRO
        • Save Customer Group
  • Change Tax Class for General Group :

    • BO > Customers > Customer Groups
      • Edit "General" group
      • Change Tax Class : Customer_TVA
        • Save Customer Group
  • Configure to automatically change group based on VAT and shipping address

    • BO > Stores > Configuration > Customers > Customer Configuration > Create New Account Options :
      • Enable Automatic Assignment to Customer Group : Yes
      • Tax Calculation Based On : Shipping Address
      • Default Group : General
      • Group for Valid VAT ID - Domestic : General
      • Group for Valid VAT ID - Intra-Union : EU_PRO
      • Group for Invalid VAT ID : General
      • Validation Error Group : General
      • Validate on Each Transaction : Yes
      • Default Value for Disable Automatic Group Changes Based on VAT ID : No
      • Show VAT Number on Storefront : Yes
      • Save Config
  • Configure Store infos :

    • BO > Stores > Configuration > General > General > Store Information
    • Country : France
    • Region/State : Haute-Garonne
    • VAT Number : FR41487768616
    • Save Config
  • Set Tax configuration :

    • BO > Stores > Configuration > Sales > Tax > Tax Classes :
      • Tax Class for Shipping : Taxable Goods
      • Default Tax Class for Product : Taxable Goods
      • Default Tax Class for Customer : Customer TVA
    • BO > Stores > Configuration > Sales > Tax > Price Display Settings :
      • Display Product Prices In Catalog : Including and Excluding Tax
      • Display Shipping Prices : Including and Excluding Tax
      • Save Config
  • Create a new Product with perfect price for our tests :

    • BO > Catalog > Products
      • Add Product
        • Product Name : TVA Test
        • SKU : TVA Test
        • Price : 100
        • Tax Class : Taxable Goods
        • Quantity : 9999
        • Stock Status : In Stock
        • Visibility : Catalog, Search
        • Categories :
          • Click on New Cateogry
          • Category Name : Test
          • Parent Category : Default Category
        • Save
  • Create a new Customer :

    • FO > Create an account

    • Add a French Address :

      • FO > My Account > Address Book
      • This is the first address so the new address form is automatically displayed, fill it :
        • First Name : Nicolas
        • Last Name : Pernot FR
        • Phone Number : 0123456789
        • Street Address : 13 rue du Moulin
        • Vat Number : Nothing here, leave it empty
        • Country : France
        • State/Province : Haute-Garonne
        • City : Toulouse
        • Zip/Postal Code : 31000
        • Save Address
    • Add a Belgium Address :

      • FO > My Account > Address Book
      • Add new Address
        • First Name : Nicolas
        • Last Name : Pernot BE
        • Phone Number : 0123456789
        • Street Address : 13 rue du Moulin
        • Vat Number : BE0834968971 (or another valid VAT number)
        • Country : Belgium
        • State/Province : Brussels-Capital Region
        • City : Bruxelles
        • Zip/Postal Code : 1000
        • Don't check Use as my default billing address
        • Don't check Use as my shipping address
        • Save Address
  • Go on product page :

    • FO > Test (category in menu) > TVA Test
    • You should see the price :
      • Including Tax : 120$
      • Excluding Tax : 100$
      • These prices are totaly OK since it is applied a 20% TVA rate.
  • Add product to cart

  • Go on Cart Page

    • Here too, prices are correct because we are still under default address TVA rate ($100 of products + $5 of Flat Rate x 1.20 of French VAT = $126)
  • Click on proceed to checkout

    • Here we see that the Shipping Method selected (Flat Rate) is $5 (excl. tax), so $5 * 1.20 of French VAT = $6. We are OK.
  • Here we want to change the adress, so we choose the Belgium address, which should be VAT exempted.

    • When chosen, Flat Rate charges are updated and there is no more anything about VAT, which is good too. Let's continue.
  • Click on next

    • Order total is now $105 ($100 of products + $5 of Flat Rate, without VAT). Which is great !
  • Place Order. We are all good for this first Test

  • Now change default address to Belgium :

    • FO > My Account > Address Book
    • Edit Belgium address
      • Check Use as my default billing address
      • Check Use as my shipping address
      • Save Address
  • Add same product to cart again.

  • Go back to the cart.

    • Here everything is VAT-exempted which is absolutely right since its Belgium defaut address tax rate which applied : so no VAT.
  • Click on proceed to checkout.

    • Shipping methods is displayed without VAT too. That's great !
  • Here, select the French address

    • Shipping Method charges are updated with VAT. So cool !
  • Click on next.

    • And now the problem : the order summary display prices without VAT and the customer will be charge without VAT even if we selected the French address subject to VAT. Big Problem.
  • Place order. If you goes in BO to check the order, the Tax amount = $0 and Tax rate 0%. The Total due is $105.

Expected result

If the customer's default address is VAT-exempt, but he chooses to be billed and/or delivered to another address that is subject to VAT, VAT should be applied to the delivery charges and to the cart.

Note : the choice to apply or not the VAT should be based on the address type selected in BO configuration here :
BO > Stores > Configuration > Customers > Customer Configuration > Tax Calculation Based On

Actual result

The VAT is not applied in the example below :

  • A Belgium address with valid VAT number is VAT-exempted.
  • A French address is always subject to VAT.
  • But if a customer has the Belgium address as default address, VAT will not be applied to his cart or delivery charges even if he choose the French address.

Additional information

I originally met this issue on 2.4.5-p1 but I test the procedure with 2.4-develop instance gave by magento-deployement service and I was able to reproduce.

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: TaxComponent: TaxIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: ready for devReported on 2.4.5-p1Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions