Copied to clipboard

Flag this post as spam?

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


  • Puck Holshuijsen 184 posts 727 karma points
    Jan 16, 2023 @ 10:51
    Puck Holshuijsen
    0

    Calculate Tax based on customer type

    Hi Matt,

    I was hoping you could help me with something.

    For a webshop i am building, there are different types of customer that can register themselves. And based on customer type, I need to calculate Tax or not.

    I know when the customer shouldn't pay any Tax , I just can't figure out how to 'disable' the Tax calculation. Is there a calculator which I can override? Or maybe some Event?

    Thanks!

    Kind regards

    Puck

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Jan 16, 2023 @ 11:00
    Matt Brailsford
    100

    There are a few options I can think of, but it depends how you customers work. Will your customers be Umbraco members and you identify them by being logged in? And, does the same tax rate apply for the customer across all products?

    If the answer is yes to both of those, I should say the simplest option might be to setup a tax class with a zero rate initially (for none logged in members) and then setup other tax classes for the different tax rates customers will pauy. Then for logged in members, maybe every time you get the current order you check what the members assigned tax class is, and if the order's tax class isn't this, you update it via order.SetTaxClass. This base level tax class will then be used across all order lines in it's calculation.

    There are other options though if there is more fine grained options needed but I'd need to know more really.

  • Puck Holshuijsen 184 posts 727 karma points
    Jan 16, 2023 @ 11:21
    Puck Holshuijsen
    0

    Hi Matt,

    The customers are Umbraco Members, and you need to be logged in to order. I basically have 2 types of members: consumer and company. The company doesn't need to have the tax.

    What you are suggesting is creating a new TaxClass with 0% tax. enter image description here

    And during creating/getting order setting that TaxClass (this is my custom OrderCreate class)? Eg. enter image description here

    Thanks!

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Jan 16, 2023 @ 11:33
    Matt Brailsford
    0

    Yup, basically 👍

  • Puck Holshuijsen 184 posts 727 karma points
    Jan 16, 2023 @ 12:30
    Puck Holshuijsen
    0

    Got it working! Thanks again :D

Please Sign in or register to post replies

Write your reply to:

Draft