Colorado retail fee

General ShopSite user discussion
Post Reply
johnbiggs
Posts: 1
Joined: Tue May 31, 2022 1:09 pm

Colorado retail fee

Post by johnbiggs »

So Colorado are implementing a retail fee charge on each ecommerce order.
Does shopsite have a patch planned to enable us to implement a set amount charge for Colorado orders ON TOP of percentage tax rates?
Or is there already something available that will enable us to do that specifically for those orders, and also record them?
ShopSite David
Site Admin
Posts: 317
Joined: Fri Aug 04, 2006 1:30 pm
Location: Utah
Contact:

Re: Colorado retail fee

Post by ShopSite David »

We are waiting to hear back from the AvaTax folks to see if they handle it in their system. But there is a way in ShopSite Pro with some JavaScript to do it if you are using a real-time shipper like USPS, UPS, etc. where the zip code is displayed on the shopping cart screen.

In Commerce > order system > Shopping cart
in the Surcharge Pull-down add:
No Delivery Charge
Colorado Delivery Charge;+0.27


In the Text at the bottom of the Shopping Cart screen add:
<script>{let f=document.order,$=ss_jQuery;if(f.zip_code){let colorado_check=function(e){console.log('colorado check');let s=f.querySelector('[name="shipoptmenu:0"]'),v=((/^(80[0-9]{3}|81[0-6][0-9]{2})/.test(f.zip_code.value))&&s.querySelector('option:nth-child(2)')||s.querySelector('option:nth-child(1)'));$('#col-tax-label').text(v.innerText);s.value=v.value;};f.addEventListener('submit',colorado_check);f.zip_code.addEventListener('change',colorado_check);$('[name="shipoptmenu:0"]').hide().before($('<div id="col-tax-label"></div>'));colorado_check();}}</script>
-David H.
ShopSite, Inc.
http://www.shopsite.com
lneibauer
Posts: 112
Joined: Tue Sep 30, 2014 7:13 am
Location: Warminster, PA
Contact:

Re: Colorado retail fee

Post by lneibauer »

Thanks David, I have been doing some testing on our sandbox site and this works well. We only ship items to Colorado because our shop in in Pennsylvania. is there a way to modify the script to automatically implement the fee based on a Colorado zip code? as well as the script works, it still requires the customer to be honest and as retailers we all know most customers will try and get away with anything they can. :D. I am not a javascript programmer so I would need some assistance.

Thanks
jrasmussen
Posts: 2
Joined: Mon Feb 22, 2016 2:30 pm

Re: Colorado retail fee

Post by jrasmussen »

Hi,

It sounds like you have a problem with the javascript like it wasn't copied correctly. It is all supposed to be in one line but the browser inserts some line breaks that would cause errors. Here is a better formatted javascript to be put into the "Text at the bottom of the Shopping Cart screen" field on the Commerce > Order System > Shopping cart Configuration screen:
<script>{let f=document.order,$=ss_jQuery;if(f.zip_code){
let colorado_check=function(e){
let s=f.querySelector('[name="shipoptmenu:0"]'),
v=((/^(80[0-9]{3}|81[0-6][0-9]{2})/.test(f.zip_code.value))
&&s.querySelector('option:nth-child(2)')
||s.querySelector('option:nth-child(1)'));
$('#col-tax-label').text(v.innerText);s.value=v.value;};
f.addEventListener('submit',colorado_check);f.zip_code.addEventListener('change',colorado_check);
$('[name="shipoptmenu:0"]').hide().before($('<div id="col-tax-label"></div>'));
colorado_check();}}</script>
Jim
Post Reply