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.

Subscribers overcharged when paying past dues

SomeDumbFoxSomeDumbFox Member
in Help edited October 2014
Hello, I'm helping out a friend with his store, and I can see that when using custom tiered shipping, subscribers get overcharged when they attempt to pay past dues. My fix in the mean time is to adjust the past due amount so that it ends up matching the original amount.

Their checkout will look something like this.
cart.PNG

Obviously the overcharge is because of the custom shipping logic. I've noticed that the line "Future Subscriptions Shipping and Handling" does not match the shipping and handling to zero out the overage.

So I've done some digging around and have come to find that the variables responsible for "Future Shipping and Handling" is
FC.checkout.config.orderFutureShipping

I've tried adjust it so that it remains equal to shipping and handling, but then realized that this also effects regular transactions and the two will always cancel each other out from the checkout JS logic. So that doesn't work, and it also causes some undesirable events when someone tries to update their sub as well, specifically having a total of $1.78 when everything is $0.00.

I'm stuck at how to approach this, and I would like to know how to solve this problem. The store domain is pokecrate.foxycart.com and I've commented out the line of code that I have added, so it brings it back to the original logic for custom shipping. We're using foxycart version 1.1.
Comments
  • fc_adamfc_adam FoxyCart Team
    @SomeDumbFox,

    The direction you've started there is a good approach - but you just need some additional logic to make sure it only applies when a past due amount is being handled. Try this for the calculate shipping function:
    http://pastie.org/private/ikt8yvyyspnnvifzwpohma

    I've added some code in there which checks if the past due amount is the only amount being charged for - and if so, makes the future shipping costs match. It also makes the 'amount' variable be only for non past due products - so the shipping won't look incorrect there as well.

    Hopefully that gets it all working for you!
  • SomeDumbFoxSomeDumbFox Member
    edited October 2014
    @fc_adam

    Thank you very much, I tested it out and it worked beautifully. I'm not familiar with JSON, and to be honest I found the references provided a bit confusing. This is a big help.

    Now I have one more question, I noticed the same issue happens when a customer decides to update their information. I added in this line after the shipping calculations to see if it'll work.
    if(FC.checkout.config.isUpdateCustomer == true) {
    	shippingCost = 0;
    }
    

    It didn't, and I've come to realize that this will only work if the updateinfo parameter was sent through the link. I've also tried something similar to the the first solution above, by simply changing the AND logic to OR logic in line 29, however I end up with a total anyways. It'll look like this

    cart2.PNG

    Which is a little confusing because I have no idea where the $1.78 is coming from. This only happens when someone updates a subscription.

    total.PNG

    I reversed the changes I made, as it's clear I'm not addressing the issue properly. From what I understand the $1.78 is not charged against the person, which is comforting to know, but looks very misleading. However when the shipping is not negated, our customers do get charged the shipping and handling. This is something we do not want. What is a way to make sure that updates to subscriptions display $0.00 as the total?

    Thank you for helping me, and sorry if I'm asking too much out of you guys. You've been incredibly helpful to me!
  • fc_adamfc_adam FoxyCart Team
    @SomeDumbFox,

    So what you're running into there is a weird bug in javascript, what the order total actually is is 0.0000000000000001776... which is represented in javascript as "1.7763568394002505e-15". When that is parsed to our currency formatter, that's coming out as the $1.78" total you see.

    I'm going to discuss this with one of our developers to see the best way to handle this. The change you made to make it "or" rather than "and" would be the way to fix it for update requests as well - once get get the second issue fixed though...
  • @fc_adam

    Sorry for the late reply. I can get lost in some of my other jobs. I greatly appreciate the input, I believe that's it for the help I need.

    Thank you
Sign In or Register to comment.