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.

Override Flat Shipping rates

MokoJumbieMokoJumbie Member
in Help edited May 2013
I'm attempting to use flat shipping rates and override them, inserting my own custom shipping calculation logic. I don't want any other shipping options to show up. But I am having a hard time finding documentation on stopping the regular flat rates from applying automatically. What's the best way to go about this? Should I be taking a different approach?
Comments
  • fc_adamfc_adam FoxyCart Team
    @MokoJumbie,

    When using custom flat rate shipping on your checkout, you need to set the flat rates of your categories to $0 - and purely set your custom shipping via javascript on your checkout. For flat rates on the checkout, I'd suggest using either the tiered or the multiple flat rate snippet available from our wiki here: http://wiki.foxycart.com/snippets/start
  • Thanks adam, I couldn't even get something as simple as the single flat rate snippet to work. http://docs.foxycart.com/snippets/shipping/setting_single_flat_rate_shipping_amount

    I can disable multiship after page load by using:
    FC.checkout.config.hasMultiShip = false;
    then calling:
    FC.checkout.updateShipping(-1);
    Which will then update the shipping to the correct price.

    But I have multiship disabled in the store settings. Where is hasMultiShip set to true?

    Also, I'd like to have shipping initially display TBD for flat rates until I update the shipping price. Is that possible?
  • fc_adamfc_adam FoxyCart Team
    @MokoJumbie,

    Could you link me to your store? Feel free to whisper it if it's private
  • fc_adamfc_adam FoxyCart Team
    @MokoJumbie, {in response to whisper}

    Looking at your checkout source code, I'm not seeing hasMultiShip as being set to true by default - are you still seeing that?
  • Right, I'm not setting it to true. But if I use the console to check the value after page load, it's still set to true. Are you seeing something else?

    If it's set to true, I can't update the shipping to display the values that I can see are correct in the config.
  • fc_adamfc_adam FoxyCart Team
    edited May 2013
    @MokoJumbie,

    If I check "FC.checkout.config.hasMultiship" in the console after the page has loaded (and note the lowercase 's' there for 'ship') it is returning false. That variable isn't updated anywhere in the checkout javascript - whatever it is set to in the config in the source code is what it should stay as.
  • OMG, a typo. *facepalm*. Okay, well that did it. Awesome, thanks!

    Now is it possible to get the shipping to display 'TBD' before I update the price or is that only possible for live shipping?
  • Sorry, for anyone following this, that was pretty vague of me. I had hasMultiShip set to false when it should have been hasMultiship with a lower case 's'.

    I should note, however that it may be a good idea to note that the current snippet I was using at http://docs.foxycart.com/snippets/shipping/setting_single_flat_rate_shipping_amount doesn't work with multiship.

    But Adam, this still doesn't explain why I had to set hasMultiship to false in the first place, as it's disabled in the shop settings. Any idea why that would be?

    I can feel another oversight of epic typo-sized proportions coming on...
  • fc_adamfc_adam FoxyCart Team
    @MokoJumbie,
    But Adam, this still doesn't explain why I had to set hasMultiship to false in the first place, as it's disabled in the shop settings. Any idea why that would be?

    You don't - as I mentioned, when I checked the value in the checkout.config object, hasMultiship was returning false - it wasn't set to true for me.

    Now is it possible to get the shipping to display 'TBD' before I update the price or is that only possible for live shipping?

    Oh sorry - missed that earlier. That's a good question - and I'm assuming you're just wanting to prevent the flash of the shipping being $0.30 before it's recalculated?

    Probably your best approach there would be to add in a custom table row to the totals that duplicates the shipping total row, but sets it up to just show "TBD". That row would be displayed, and set the other table row to be hidden by default. You'd do this using the Twig template functionality available since FoxyCart 1.0. Then, in your javascript there, you'd hide the TBD line and show the calculated line.
  • You don't - as I mentioned, when I checked the value in the checkout.config object, hasMultiship was returning false - it wasn't set to true for me.

    Ah, sorry, I misunderstood before. Well, it's very strange, because if I don't manually set it in the head, It somehow evaluates to true. I'll do some more checking and report back.
    Oh sorry - missed that earlier. That's a good question - and I'm assuming you're just wanting to prevent the flash of the shipping being $0.30 before it's recalculated?

    Basically, yes. However in my case, because of the weird multiship issue I am having, it initially displays $0.00.

    That sounds like a decent workaround. I'l give it a shot. Thanks so much for all your help. You guys are fantastic. Looking forward to the new shipping functions! Canada Post integration FTW! :D
Sign In or Register to comment.