The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Calculated tax slightly off

salsal Member
in Help edited January 2008
We've noticed that the orders on our FoxtCart account don't quite calculate how we thought for orders so I'm checking if this is a bug or whether it's just a weird way they're totaled. See this screen cap for example. The relevant values are

Tax - 12.5%
Shipping - $5 + 5%

Whether it's "(sub-total + $5) + 12.5%" or "(sub-total + 5%) +12.5%" or any other combination, the Tax doesn't seem to match the FoxyCart returned tax.

  • lukeluke FoxyCart Team
    Subtotal = $53.34
    Handling Fees = 5% of $53.34 ($2.67) + $5 = $7.67
    Tax = 12.5% of $53.34 = $6.67

    It's probably not clear, but we're calculating the tax before the shipping and handling fees... which is pretty standard in the US. Do we need to give you the option to calculate before or after?

    Probably. Hmm. fun. We'll get there. Eventually. :)

    If enough people want it, we'll do it!
  • salsal Member
    It would great if it wasn't too much trouble to have the option of calculating tax on sub-total + shipping & handling. Thanks.
  • lukeluke FoxyCart Team
    We just had another customer request this feature today so we'll definitely be implementing it.

    Thanks Sal!
  • I just had a client ask for tax on shipping as well the product itself. Is that something you will be adding soon?

  • lukeluke FoxyCart Team
    I always get in trouble when I say "soon..."

    It probably won't make this next version, but it will definitely be in the one after that. Stay tuned.
  • Greetings Luke,

    Out of curiosity, do you have a timeline as to when this issue will be resolved? I just got another e-mail from my client this morning wanting an update as they're continuing to have problems with this issue.

  • lukeluke FoxyCart Team
    We'll work towards adding this into the next version... but the next version will take a little while as we have some other things that need to get done as well (UPS, payment gateways, coupons).

    If they need a little bit of extra added in for tax on shipping, they may need to add a bit of a handling fee. It's hack, we know, but that's all we can offer at the moment.
  • Luke, we need this option of tax on shipping/handling fee as well.

    Up here in Canada, there is a Goods & Services Tax (GST) on everything. Shipping and Handling is a service (via FedEx, Canada Post, etc), so it must be taxed. Since this isn't an option in FC yet, is there a way to hack it so?

    As an example I've used jQuery to make possible multiple flat-rate shipping options. See here...

    Can I tweak what I'm doing here to get at functions that will calculate tax on shipping and then correctly update the "tax" and "order total" fields?
  • lukeluke FoxyCart Team
    Well... this would be a hack and won't work in future versions, but there is a js global you could use: fc_orderTax

    If you could run a function to update that variable after the customer selects a shipping method, that might work. Now that the UK payment gateway is behind us, we're back on track with the restructuring project and this feature will be part of the next release.
  • jeffphillipsjeffphillips Member
    edited April 2008
    GST is annoying but do you have any questions why this feature is important and why your suggestion of padding handling fee's isn't a viable option? I'd be glad to try and explain but won't attempt to if you're already good.

  • I played around with this and got to a jam. I've mostly got it working but come to a problem with the "fc_getTax(multiship)" function. Here's my custom function with it's event trigger.

    Event: (showing code for whole radio input):
    <input type="radio" name="shipping_service" onclick="updateTaxOnShipping(15)" value="1|15" id="shipping_service_1" />

    function updateTaxOnShipping (price) {
    	var GST = 0.05;
    	var shipTax = (price*GST);
    	fc_orderTax += shipTax;

    The alerts are for testing and if uncommented show that the global fc_orderTax get's updated properly. However, it seems to be ignored from then on. I thought it would be referenced again in "fc_UpdatePrice()". But fc_UpdatePrice() gets tax info by calling the function "fc_getTax()".
    function fc_getTaxes(multiship) {
        var taxes = 0;
        var potentialTaxes = 0;
        if (multiship == -1) {
            potentialTaxes = 15;
        } else {
            potentialTaxes = fc_multishipTaxes[multiship];
        taxes = potentialTaxes;
        return taxes;

    This is where I get into a jammer. Tax is somehow being hardcoded in the var "potentialTaxes" and returned for calc in UpdatePrices(). I don't know how to get at it. If it used the global fc_orderTax it might work.
  • lukeluke FoxyCart Team
    That's one of the many reasons we're currently restructuring our core checkout objects. The JavaScript as it stands now is a bit confusing... but that's also why there are so few single page login+signup+checkout systems anywhere on the internet.

    We've got a lot of work to do, but we will get it done. Eventually, we'll open up some of this JavaScript to give developers complete flexibility in the process. Obviously, the ideal solution is to handle everything on the backend so that shipping and taxes can't be spoofed. We're getting there.

    So, to be clear, you need a special tax that is just calculated on the shipping and not the cost of the order? "Goods" and services doesn't include the whole order?
  • No, a special tax is not required, shipping just needs to be included in the tax calculation. Currently it is ignored. Shipping could be viewed as just another item on the list and 5% GST charged on the subtotal to get orderTotal. Math goes like this:
    (Sum of items and shipping) * 0.05) + (sum of items and shipping) = orderTotal

    Jacket: $200.00
    Shipping: $25.00

    ((200 + 25) * 0.05) + (200 + 25) = orderTotal
    11.25(tax) + 225 = orderTotal
    236.25 = orderTotal

    [Check: 236.25 / 1.05 = 225]

    Of course,it's best to separate out tax calculations (on items and tax) because users will likely be provided multiple shipping options (i.e. vendors, lower cost, faster delivery , etc). Thus, tax can dynamically be calculated depending on user choices.

    I'm glad to here work on the next version is on the way. In the mean time, if there's not a work-around I may just add tax to the flat-rate shipping. That way the final total will at least be correct even though the the "Tax" breakout on the receipt will be incorrect.
  • lukeluke FoxyCart Team
    Thanks Jeff, we'll get it in the next version. It seems like I've said that before... but this time I actually mean it. :) We snuck out a version or two before this restructure because we wanted to focus on what the highest number of clients needed. It sounds like this is the next hot item on the list so we won't do another release until this is taken care of. As part of the restructure, shipping and tax calculations are being completely rethought so it's a good time to figure this out anyway.

    Thanks for posting.
  • Me and the girls are looking forward to the updates. I'll let the pharmacist know. Hey, sales are up!
  • salsal Member
    When's the next version slated for release?
  • lukeluke FoxyCart Team
    Hey Sal. We haven't yet set a hard fast date because this next version is going to be pretty detailed. We're working hard though.
Sign In or Register to comment.