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?
This is super helpful! Any idea how to not have tax added on top of this delivery fee?
The 3rd parameter is “taxable” https://woocommerce.github.io/code-reference/classes/WC-Cart.html#method_add_fee you can pass
Chris S. says
This works great, thank you.
However, it is adding it to Virtual and Downloadable products. Any way to exclude those?
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.
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_shippingmethod as a conditional.
I’ve updated the snippet…give that a try.