Copied to clipboard

Flag this post as spam?

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


  • Edgar Rasquin 326 posts 925 karma points
    Jan 16, 2023 @ 13:34
    Edgar Rasquin
    0

    How to display price with tax

    Hi,

    does anyone know the best way on how to display the prices with tax when shop settings are

    Prices Include Tax : false

    In the cart I tried to use

    @(item.OrderLine.UnitPrice.Value.WithTax)
    

    but that returns the net price.

    In the product.cshtml I tried

    decimal netPrice = Model.CalculatePrice().WithTax;
    

    but here also it shows the net price.

    Am I missing something?

    Thanks

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jan 16, 2023 @ 14:00
    Matt Brailsford
    0

    So your orderlines in the order object should already have tax applied, but it depends what your's order Tax Class / Tax Rate is set to as it's this that will determine the calculation.

    You'll need to ensure your order has a tax class assigned to it and that tax class needs to have a tax rate, then Vendr will perform the calculation for you.

  • Edgar Rasquin 326 posts 925 karma points
    Jan 17, 2023 @ 13:32
    Edgar Rasquin
    0

    Hi Matt,

    sorry if its a stupid question, but where can I assign a tax class to the order?

    Thanks

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jan 17, 2023 @ 13:40
    Matt Brailsford
    0

    order.SetTaxClass(taxClass) or it will usually also set it based upon what is the default tax class for the default currency.

  • Edgar Rasquin 326 posts 925 karma points
    Jan 17, 2023 @ 13:48
    Edgar Rasquin
    0

    ok, my order has a taxClass assigned

    enter image description here

    But even though in the tax class the default value is 22% the tax rate in the order is 0,00%

    enter image description here

    Thanks

  • Edgar Rasquin 326 posts 925 karma points
    Jan 17, 2023 @ 13:57
    Edgar Rasquin
    0

    ok, my order has a taxClass assigned

    enter image description here

    But even though in the tax class the default value is 22% the tax rate in the order is 0,00%

    enter image description here

    Update: But it seems that the OrderLine has no TaxClass Id. Why does that not get assigned?

    Thanks

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jan 17, 2023 @ 14:02
    Matt Brailsford
    100

    Hmm, so first thing it doesn't matter if the order line has a tax class ID or not, it just means if it doesn't, it falls back to the order tax class that is used. This is what allows you to have product / order line specific tax rates.

    So the only other thing I think that should affect this is the orders billing / shipping country as those need to be set in order for it to know which tax rate to apply.

  • Edgar Rasquin 326 posts 925 karma points
    Jan 17, 2023 @ 14:28
    Edgar Rasquin
    0

    OK, now I get it. Because I tested switzerland (0%) before, these informations got stored in the cookie and where from then on applied in all other views.

    And even if I delete all products in the shopping basket, I still see the prices according to the TaxRate that was assigned to the last selected delivery address (country).

    Once I clear the cookie, I fall back on the default Tax Class Standard Rate.

    Is this the intended behaviour?

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jan 17, 2023 @ 14:32
    Matt Brailsford
    0

    I mean, I guess.

    An order won't know really if the tax class changes outside of it, so I guess it didn't know to update it's tax rate and so because the tax class was never changing, it just knew "there is no point recalculating this as it's not changed".

Please Sign in or register to post replies

Write your reply to:

Draft