0

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}" />
0

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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