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.

.7 custom_fields to 2.0 custom_fields

Hi Guys,

What would be the correct syntax for this old legacy string:

var the_donation_val = fc_json.custom_fields["Donation"];

In the new 2.0 cart template?


  • fc_adamfc_adam FoxyCart Team

    Good question. For 2.0, you'd need to tackle it like this:
    var the_donation_val = FC.json.custom_fields["Donation"].value
    For future reference too - you can navigate through the FoxyCart json by typing FC.json into your browsers console and you can then expand the different aspects of the current cart's JSON.
  • Thanks again Adam!
  • Why is this not working to hide the 'Calculate Shipping' div in the cart template?


  • fc_adamfc_adam FoxyCart Team

    With how our templates work in 2.0, they are rerendered using javascript to update the page as aspects change. That means that if you make a change to the template using javascript, when that portion is rerendered, that change will be lost.

    You'll want to hide that section using CSS instead.
  • You said:

    "With how our templates work in 2.0, they are rerendered using javascript to update the page as aspects change. "

    My Question:

    Is there a function I can run similar to $(document).ready(function() { // DO THINGS }

    That will execute anytime there is a re-rendering of the template?

    We have allot of unique customization from the old cart/checkout I need to make work in 2.0

    Thank you.
  • fc_jedfc_jed FoxyCart Team
    edited September 2015

    What you need is the render.done event. Specifically:
    FC.client.on('render.done', function() {
    // Custom code
    Have a look at this link for more information regarding FC events:
  • Thank you! I'll give it a shot.
  • fc_adamfc_adam FoxyCart Team

    Another thing to consider as well - depending on your customisations it might make sense to make some of them within the Twig template directly as well. That way it's just handled natively within our templates rather than needing to alter with javascript.
Sign In or Register to comment.