Support » Plugin: WooCommerce » Can some shipping classes be taxable and other tax-free?

  • Resolved richplane


    I have a client whose products require various different shipping types. For instance, some require refrigerated shipping.

    Some of these shipping types are taxable and others are tax-free.

    The shipping types are set as ‘Shipping classes’ on the products, each of which has its own price, but as far as I can see, tax can only be on or off for an entire shipping method. I only have one shipping method as the whole site is UK delivery only and there are no choices in how things get delivered – it’s set by the products.

    Charging shipping by the most expensive shipping class is fine, but part of the job is to have tax-exempt customers, so I need the shipping types to respond correctly.

    Does anyone have any suggestions of anything better than using a filter on woocommerce_calc_shipping_tax which hardcoded tax exemptions by shipping class? (Would that even work?)

    Anyone got any advice on this?

    Thanks all,

Viewing 7 replies - 1 through 7 (of 7 total)
  • Danny Santoro


    Automattic Happiness Engineer

    Hi Richard,

    Tax isn’t set in the shipping class level, but you can change it in the product level, so any items in a particular shipping class can be modified so a different tax rate (such as 0) applies: it’s just in the product settings.

    Hi Danny, thanks for responding.

    Are you saying I should set the product as not taxable in order to get the shipping to be tax-free? That’s not going to work because the products *are* taxable. The problem is that some customers will shop tax-free. That will affect the cost of all of the products but only some of the shipping methods.

    Have I misunderstood you?

    Danny Santoro


    Automattic Happiness Engineer

    Ahh, I apologize, I misread the original post. 🙂

    So there’s a bit of snippet code that you can use. What you’d need to do is create different user groups – you can do that using the free Groups plugin: (you could then assign certain users to be tax free).

    Then, you can use the example code here:

    You’d want to change line 6 so distributor is whatever slug for the tax-exempt user group. It would be added through your functions file, so you could use My Custom Functions: or the guide here: How to Safely Add Code to your Theme’s Functions File.

    The last remaining bit would be a way to auto-assign a group to a certain user, if that’s part of what you need. You can manually assign without any extra code, but to auto-assign you’d want to create a second login page that would assign them to a specific role. That would likely be a custom job, but there may be a plugin out there that does it that I just couldn’t find. For that part, I suggest contacting someone on the WooCommerce Customizations page.

    That’s great, answers how I set some customers as tax exempt, so that’s very useful, thanks.

    However that still doesn’t solve the problem of making some shipping classes taxable and some tax-free. Setting a customer as tax exempt makes a difference to the cost of the shipping classes that are tax-free and not the others. As I said, having different settings for the method won’t work (out of the box) because the customer shouldn’t be able to choose the type of shipping – it depends on the requirements of the products.

    At the moment I’m looking at setting up two different shipping methods, one tax-free and one taxable, setting the rates for each of the shipping classes and then hiding whichever of the methods isn’t appropriate for the cart (the most expensive) using a filter on ‘woocommerce_package_rates’. It’s not straightforward!

    • This reply was modified 1 year, 11 months ago by  richplane.
    Plugin Support dougaitken


    Automattic Happiness Engineer

    Hi @richplane

    Did you get any more clarity outwith this thread?

    So you can’t add tax to a shipping class straight away, but you could work around this by adding advanced costs onto the class using flat rate shipping?

    Something I’m thinking about that might be useful is using our Conditional Shipping and Payments extension. If these VAT/no VAT customer are user roles then you could use that to control the shipping method, which in turn will have “VAT” added.

    I hope this helps,


    Hi Doug – I’m not sure exactly what you’re suggesting there… as far as I can see, the Advanced Cost would only achieve the same as adding tax on to the shipping method, it can’t be dependant on the product shipping class which is what I needed to achieve.

    I now have a very complicated solution which involves having a shipping method for each shipping class, and then having code hook into ‘woocommerce_package_rates’ which goes through the cart contents & examines the shipping class of each product to decide which shippping method to display.

    It does look like I’ve replicated some functionality available in that plugin – wish I’d spotted it in the extension store when I scanned through it at the start of the project. I don’t know for sure that it would do what I need, though, and this solution seems to work, so I’ll probably leave it at that.

    But preferable to all of this would be the ability to set shipping classes as taxable or not.

    Thanks for your help, anyhow

    Plugin Support Hannah S.


    Automattic Happiness Engineer

    Thanks for letting us know where you ended up. I’m going to mark this thread as resolved now.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Can some shipping classes be taxable and other tax-free?’ is closed to new replies.