Copied to clipboard

Flag this post as spam?

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


  • Daniel Nielsen 17 posts 102 karma points notactivated
    May 23, 2022 @ 09:56
    Daniel Nielsen
    1

    General tax question

    Hi.

    First problem:

    I want to have the store without tax, when browsing the products and viewing the cart. This i have solved by having a Tax Class called Zero where the rate is 0. And on every product i have Tax Class set to zero. And the store is set to not include tax.

    Is this the best practice of solving this?

    Second problem:

    When i arrive on the checkout page, i want to have a button to toggle tax on some products, this is determined by the category the product belongs to.

    As an example, i have Product A, and Product B. Product A belongs to the category NoTax Product B belongs to the category WithTax.

    As default these prices on Product A and Product B should be viewed without tax, until i toggle the add tax button at checkout.

    When i toggle the button at checkout, it should leave Product A as is, and add my tax class to Product B and update the cart in my checkout view.

    How can i achieve this?

    I have been playing around with the order lines, and i cant seem to find a way to update the tax class on a single order line.

    Best Regards Daniel

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    May 23, 2022 @ 10:01
    Matt Brailsford
    0

    Hi Daniel,

    Generally speaking you would define the different tax rates supported by your store in the settings section and then define the "Default Tax Rate" of the store to be whatever is your default (so here, Zero). For your products, you can then define a tax class property on the product node and if you product should have tax applied, you can choose the tax rate that should be used. By having a tax rate property on the product Vendr will autoatically apply this.

    I'm not quite sure why you need the button, but I'd probably say this could be handled in your implementation. All order prices contain their exc-tax and inc-tax values in various sub properties of a price so you can decide whether to display it with or without tax. I guess if you want to use a button, you can have it toggle some cookie value or something to say which price to actually display.

    Hope this helps

    Matt

  • Daniel Nielsen 17 posts 102 karma points notactivated
    May 23, 2022 @ 11:46
    Daniel Nielsen
    0

    Hi.

    I need a button to toggle between tax rates, because I need companies to pay for a product without tax rates included, and people that buy a product for private use, to pay taxes.

    This is a question every customer has to decide in the checkout flow, and therefore I need to update the price based on the type of customer (company/private)

    Hope this make sense.

    Will I be able to create a custom calculator that inherits from IOrderLineCalculator, to fulfil this wish?

    Or is the solution to use some sort of cache/cookie as you described?

    Best regards Daniel

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    May 23, 2022 @ 13:33
    Matt Brailsford
    1

    Do the products where you pay tax share the same tax rate? If so, it might be easier to do this the opposite way round which is to say set the default tax rate of the order to the one that is changeable, but any order lines / products that will ALWAYS be zero rated, have them with a tax class property of "Zero Rated" but any products that need to toggle, don't set a product tax class and so default to the orders selected tax class.

    Then when you need to toggle between taxed or zero rated you can call the SetTaxClass(Guid taxClassId) on the order to toggle the base tax rate and so any order lines with no explicit tax rate will switch between taxed and zero rated, where as those order lines with a product that has an explicit zero rated tax rate will always be zero rated.

    Your button then shouldn't need to set a cookie, but simply call the SetTaxClass method on the order to use the correct tax rate.

    I think this would be the simplest option.

    Hope this helps

    Matt

  • Daniel Nielsen 17 posts 102 karma points notactivated
    May 24, 2022 @ 06:05
    Daniel Nielsen
    1

    Hi Matt.

    That's correct, on products where we pay tax they share the tax rate.

    Just tried your solution, and it solves our problem.

    Thanks for the fast replies and the solution.

    Best regards Daniel.

Please Sign in or register to post replies

Write your reply to:

Draft