Hi wondering how I could set quantity to 1 if the user has entered a price.

I'm adding multiple donations to cart within product form tag and want to hide the quantity input. How can I check if a price has been inputed and then set the quantity to 1.

I have the following but get an invalid conditional error in template.

<input type="hidden" name="items[{count}][item_qty]" value="{if "{price}" >= "1"}1{if:else}0{/if}" />

1 Answer 1


Since the user is going to be entering the price after the initial page load when the EE tags are parsed you will need to use some form of javascript to listen to the individual price fields and then update a hidden hidden field tied to that particular product.

  • Of course! Looks like I'm stuck with a quantity then as my javascript is nil. Thanks Justin much appreciated.
    – MBM
    Commented Jan 20, 2015 at 0:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.