Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Arun 136 posts 369 karma points
    Dec 17, 2019 @ 14:02
    Arun
    0

    Is it possible to calculate the Total amount with used defined VAT rate rather than default VAT using TC functions.?

    Hi I have created a VAT Group which contains some countries with different VAT rates..

    Right now I'm using,

    var order = TC.GetCurrentOrder(storeId);

    Here in order i got total amount calculated with product price and default VAT. I need to pick one of the countries from the VAT Group based on the culture used. Is it possible to calculate the Total amount with used defined VAT rate rather than default VAT.?

    Thanks

  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Dec 17, 2019 @ 15:03
    Matt Brailsford
    0

    Hi Arun,

    You'll need to set the order Shipping Country / Region (or Payment Country / Region which will be used as a fallback if no Shipping Country / Region are defined) in order for it to know which region you want to calculate VAT for

    order.ChangePaymentRegion(countryId, regiondId?);
    order.ChangeShippingRegion(countryId, regiondId?);
    

    Once your order has a relevant region, it should calculate the VAT accordingly.

    Matt

  • Arun 136 posts 369 karma points
    Dec 18, 2019 @ 05:46
    Arun
    0

    Hi Matt I don't have a region., so i tried the mentioned code with regiondId as 0, but doesn't work

    in this case, var order = TC.GetCurrentOrder(storeId);

    I'm getting the VAT rate of the first country in the from the VAT group.

  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Dec 18, 2019 @ 09:08
    Matt Brailsford
    1

    Hi Arun,

    The region is nullable so you can pass null if you you don't have a region.

    I'm pretty sure that should be all you need for it to work. I take it you have assigned the VAT rate to the order?

    Matt

  • Arun 136 posts 369 karma points
    Dec 18, 2019 @ 15:53
    Arun
    0

    Thanks Matt : ) It works...

  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Dec 19, 2019 @ 09:04
    Matt Brailsford
    1

    Awesome 👍

Please Sign in or register to post replies

Write your reply to:

Draft