WooCommerce, Remote Work & Other Fancy Stuff

Just another WordPress site

WooCommerce & Colorado Retail Delivery Fee

June 17, 2022 by Will 6 Comments

Please consider leaving a donation if you appreciate this information. Lightning network now available

If you’re a merchant selling goods to customers in Colorado, SB 21-260 establishes a retail delivery fee that merchants are required to collect and remit to the state of Colorado. If you wish to continue to sell to customers in Colorado, you will need a solution to collect this fee. Until a proper solution exists, this code snippet will serve as a band-aid solution.

Not sure what to do with code snippets? See What Do I Do With These Code Snippets?

Please consider leaving a donation if you appreciate this information. Lightning network now available

Filed Under: WooCommerce Tagged With: snippet, snippets

Comments

  1. Karie says

    July 7, 2022 at 8:31 pm

    This is super helpful! Any idea how to not have tax added on top of this delivery fee?

    Log in to Reply
    • Will says

      July 7, 2022 at 8:42 pm

      The 3rd parameter is “taxable” https://woocommerce.github.io/code-reference/classes/WC-Cart.html#method_add_fee you can pass false to that.

      Log in to Reply
  2. Chris S. says

    August 25, 2022 at 6:41 am

    This works great, thank you.
    However, it is adding it to Virtual and Downloadable products. Any way to exclude those?

    Log in to Reply
    • Will says

      August 28, 2022 at 10:58 pm

      Off the top of my head, the only thing I can think to do would be loop through the cart items to get a shippable total to apply the fee to rather than using the cart total.

      Log in to Reply
      • Will says

        August 28, 2022 at 11:01 pm

        Wait…I take that back. Basically, if the cart doesn’t require shipping, this fee shouldn’t be added so one could use the needs_shipping method as a conditional.

        Log in to Reply
        • Will says

          August 28, 2022 at 11:04 pm

          I’ve updated the snippet…give that a try.

          Log in to Reply

Leave a Reply Cancel reply

You must be registered and logged in to post a comment.

© 2025 ยท WooCommerce, Remote Work & Other Fancy Stuff · Epstein didn't kill himself

We use cookies to ensure that we give you the best experience on our website. Continued use of this site is interpreted as your acceptance of our cookie policy.OkSee Our Cookie Policy