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.

re-run custom checkout script when info changes

dustystringsdustystrings Member
in Help edited November 2014
Hi again! I've added a custom checkbox to the checkout page, and I want to hide it when the total price is below $250 and show it otherwise. I've got the following script in the custom footer section and it works, but I'm not sure how to get it to re-run when I change an item quantity.
var amount = FC.json.total_item_price;
if (amount <=250) $("#fc .fc-checkout__additional-field--waive-signature").css("display","none");

Thanks so much!
  • fc_adamfc_adam FoxyCart Team

    You'll want to hook into some events to trigger that. For more information on events, take a look at

    For what you've described there though, this should work:
    {% if context == "checkout" %}
    function toggleWaiver() {
    	var amount = FC.json.total_item_price;
    	if (amount <=250) $("#fc .fc-checkout__additional-field--waive-signature").css("display","none");
    FC.client.on('ready.done', toggleWaiver);
    FC.client.on('cart-item-quantity-update', toggleWaiver);
    FC.client.on('cart-item-remove', toggleWaiver);
    {% endif %}

    You'll probably want to also update it to show the waive signature field if the amount is above 250.
  • That was super-fast, thank you!
  • Any idea why the hidden field is reappearing as soon as I enter an email address on the checkout page?

    I'm adding the $125 folding stand item, then putting in a zip code (98107) in the sidecart. When I go to check out, the waive signature field is hidden, but when I enter my email address at the top of the page, the field suddenly appears.
  • sparkwebsparkweb Member, Integration Developer, FoxyShop, Order Desk
    I think you want to make sure to run your toggleWaiver on
    in addition to the other events.
  • Actually, it doesn't seem to be triggered at all when quantities are changed. The only time it's triggered without refreshing the page seems to be when I input an email address, which is very strange. I did add

    else $("#fc .fc-checkout__additional-field--waive-signature").css("display","block");

    after the if statement. Was that the wrong way to do it?
  • @sparkweb,

    Thanks, I'll try that!
  • That fixed it, thanks!!
Sign In or Register to comment.