Custom Tax Calculations for Foxy via a Quick & Easy Netlify Serverless App
November 18, 2021 - How To・Product Updates
Have you ever thought, “What I really need for e-commerce bliss is the ability to do super custom tax logic”? Do you wake up in a cold sweat worrying about your unique tax rules?
We don’t, thankfully, but if that’s you, we have good news! Earlier this year we added the ability to configure a custom tax calculation endpoint for your Foxy store. It’s similar to the custom shipping endpoint, and allows effectively unlimited flexibility as it relates to applying sales taxes to your Foxy-powered transactions.
Why would you need a custom tax endpoint?
Good question. Though Foxy supports Avalara’s AvaTax, TaxJar, ONESOURCE Indirect (on our Enterprise Plan), as well as built-in rates (for the US, Canada, and the EU) and the ability to set static rates for countries and states/provinces, sometimes those just aren’t sufficient. Perhaps you have tax rates in your ERP that you need to use, or perhaps you’re selling something that has extremely specific tax rates or thresholds.
We’ve also helped larger enterprises who have their own tax functionality and can’t easily expose it externally, but that can build their own middleware to interact with Foxy.
Not the most common use cases, granted, but when you need it, there’s really no alternative. And now you’ve got it!
Deploy a serverless custom tax endpoint on Netlify
Because we’re big, big fans of all things serverless, we did up a little starter script as part of our “Netlify E-Commerce Starter Scripts” available at https://github.com/Foxy/foxy-node-netlify-functions. That repo now includes a custom tax endpoint serverless function, which can be extended to query whatever 3rd party services you might need.
If you haven’t played with Netlify, it’s a fantastically easy (and typically free) way to get started with serverless functions (and works for static site generators and many other things as well). If you use hosted website builders like Webflow, Wix, Squarespace, or if you do static sites, but you need some dynamic serverside functionality, Netlify’s Functions are about 1000x easier to deploy than AWS Lambda (even with the wonderful Serverless.com framework) or Cloudflare Workers are, and our hope is that our starter repo will help you experience the wonderful world of serverless functions 🙂