Is it possible to set a maximum order quantity with Exp:resso Store? The site I'm working on would like to offer free samples. Any help or direction would be greatly appreciated.
3 Answers
There's no option to set a maximum quantity in the Store field itself but you could do a check for this in your templates with a little javascript to stop users from adding more than X items to their cart by checking for the quantity field
<input type="text" name="item_qty" size="3" value="1" />
If it applies to the order as a whole then you can use checking in your templates:
{if order_qty > '10'} You are only allowed a maximum of 10 items {/if}
I can see that it could be a common use case however.
I had the same situation on a site recently where client was offering samples on a SINGLE product. They needed to limit the samples to a maximum of 2 per order. Depending on how dynamic you need to make it you could do the following:
{if url_title == "your-product-name"}
<label class="field_label">Qty
<select name="item_qty">
<option value="1">1</option>
<option value="2">2</option>
</select>
{if:else}
<label class="field_label">Qty <input type="text" name="item_qty" size="3" value="1" class="input_sml" /></label>
{/if}
It's now on the feature request page, so feel free to vote this up!