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.

Reset only visible quantity fields to zero?

I'm using a snippet of code to reset all quantities to zero when the cart is closed, and it has worked great so far.

var FC = FC || {};
FC.onLoad = function () {
FC.client.on('cart-submit.done', function () {

But now I'm adding a gift certificate product with a user-editable price and a hidden quantity of one, and I'm wondering if there's a way to modify the script to exclude this particular product. Once the quantity resets, there's no way for the customer to add another one to the cart because the quantity field is hidden and stuck on zero. Is there a way to specify that the reset only applies to visible quantity fields and not to hidden ones? Or that it only applies to fields with a particular class? (Sorry, I know very little about javascript...)

I'm also interested in resetting the price field to value="" on this product, but I obviously don't want this to happen for my normal fixed-price products.

I'd be grateful for any advice!
  • fc_adamfc_adam FoxyCart Team

    Ah - that would be a frustrating experience! You could use jQuery's filter() function to just get the inputs that are visible, like this:


    In terms of targeting the price input - assuming that it's also the only one that is visible, you could take the same approach.
  • @fc_adam,

    Works like a charm. Thanks so much!
Sign In or Register to comment.