Forum

Thread tagged as: Problem, Shop

3 decimal places on tax rate

Reference: http://forum.grabaperch.com/forum/03-25-2017-new-york-state-sales-taxes

Hi,

I'm setting up my first Perch Shop for a client here in Quebec Canada. We have 2 tax rates: 5% and 9.975%. On the tax location page, i cannot set the tax rate to 14.975. There is a step attribute of 0.1 on the tax rate input which limits this. As the referenced link suggests, I have set the decimal on the rateValue to 5,3 to account for the extra place, but this doesn't help the interface.

When i inspect the page and set the step="0.001" to allow the input on the front end, the new value is not updated with the response. It shows the old value again. If i manually refresh the page, it then shows the new value.

I can set the value in the DB, but no only am i taking away the ability of my client to update tax rates as needed - granted this doesn't happen often but it does from time to time.

Is it possible maybe reduce the restriction on the rate values so that we can update the rates without having to inspect the page or manually update it in the DB?

Thanks.

Jordin Brown

Jordin Brown 0 points

  • 2 weeks ago
Drew McLellan

Drew McLellan 2624 points
Perch Support

Yes, have you updated it in the master template? The step value should just be there.

Hi Drew,

Yes I can do that but I am hesitant to do so: 1. Changes would be lost if perch_shop gets an update. I really do not like to modify vendor files. 2. The master template itself has comments around it saying:

<!--* Don't change this repeater - it's needed for editing tax rates. *-->

I'm not sure if there is going to be an issue in the tax calculation in the backend by doing this (rounding issue during checkout maybe ?). Can you confirm that this is a safe change and the tax will continue to calculate as expected even with 3 decimals?

Finally, even if I do this change, the updated value is not shown on return from the request. The new value is not seen in the input until you refresh the page after the save completes. I've stepped through the code execution and here is why i believe this is happening:

In the file tax.location.edit.pre.php line 121 after the data update is complete in the DB, $details gets assigned $TaxLocation->to_array() . but the value of $TaxLocation->details['itemJSON'] still holds the old value, not the updated one. As if it has not been refreshed after the database save and therefore is passed to the template and displays the old value.

Can you confirm this bug please ?

Thanks.

Drew McLellan

Drew McLellan 2624 points
Perch Support

This sounds like two distinct issues.

Are you able to update a regular tax rate?

Yes, 2 different issues.

  1. Tax rate update: if I revert the changes i made to allow for the three decimals, the same behaviour is there. The new value is not displayed on return from the form post. You need to refresh the page to get the new value. This does seem like a bug to me.

  2. Tax rate allow 3 decimals: Is it possible to verify if changing the DB column type and template to allow more decimals won't have an unexpected impact when calculating the taxes further down the checkout process. It would also be possible to have a change to the perch_shop add-on to accept more than 2 decimals included in a future perch_update?

Thanks for you time.