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.

Hiding shipping rates if a custom field is populated on checkout

flinx777flinx777 Member
in Help edited April 2014
We're doing some modifications on the checkout page to add custom input fields so the client can gather some additional information on checkout. There's going to be a custom text input field named "Shipping_Account". If a customer enters information into this field, we need to hide the real-time shipping Methods (i.e. USPS Standard Post $12.23): http://screencast.com/t/M7ChOBqwou

In the past we have used the JSON to detect if the combined product weights are in excess of a certain weight when passing info from the cart to the checkout (and thus making updates on the checkout page, i.e. https://forum.foxycart.com/discussion/4713/using-json-to-showhide-custom-input-fields#Item_16). But is it possible if we're not passing over a value from the cart to the checkout but are instead making an update on the checkout page to now hide the shipping options? I was thinking of updating the JSON information with a category named "no_shipping" which is configured in the Foxy Cart admin to not add shipping. Is that possible? If so, is there any code in the FC library that handles a function like this you can recommend? I just want to make sure if we make that update, the shipping will disappear and not force the customer to choose a shipping option before they can checkout.

Thanks!
Tagged:
Comments
  • fc_adamfc_adam FoxyCart Team
    @flinx777,

    We don't have any example code for changing categories - but unfortunately it's not as simple as changing the JSON. The cart JSON object is read-only, you'd need to send off a JSONP request to delete the existing product and another to re-add it with the new category. That could work, and one that some people have done in the past.

    Another option would be to use a snippet like the 'live rates shipping modification' available on our wiki [http://wiki.foxycart.com/snippets/start] to remove the returned live rates and instead show a custom shipping option which you could set to $0, so the customer wouldn't be charged shipping. You could also add in some further custom javascript into the logic to then hide the fields and auto-select the custom option so the customer doesn't have to do anything.
  • Ah yes, I remember once using that last option you suggested a few years ago on a similar project. Thanks for the guidance on that one.
Sign In or Register to comment.