Home › Forums › Ticket Products › Event Tickets Plus › Limit the number of tickets purchased by email address
- This topic has 4 replies, 2 voices, and was last updated 8 years, 11 months ago by Barry.
-
AuthorPosts
-
June 3, 2015 at 2:39 pm #967041Chris BlairParticipant
We are a nightly show venue that has limited seating. We would like to limit the available tickets per purchase to 5. How would we do this.
June 4, 2015 at 7:43 am #967168BarryMemberHi Chris,
So at the simplest level you can make basic changes like limiting the quantity selector to a maximum of 5.
This can be done by creating a template override for wootickets/tickets.php – simply search for woocommerce_quantity_input and look a few lines below to where you will see a field for the max_value, which you can set to 5.
This could be described as a “soft limit” and of course there is little to stop a user repeatedly adding more units to the cart by re-visiting the page, or by making separate purchases.
Implementing this as a “hard limit” would be more involved and really you would need some knowledge of developing against and tweaking WooCommerce, since this sort of logic would be handled at that level.
I hope that helps 🙂
June 4, 2015 at 9:11 am #967221Chris BlairParticipantI found the fine and agree this may be the fix. We are just trying to slow people down a bit.
‘max_value’ => $product->backorders_allowed() ? ” : $product->get_stock_quantity(), ) );
Here is the line of code I think you want me to change. If so where should I place the QTY. Also how to I keep this from changing if there is an update?
June 4, 2015 at 9:29 am #967228BarryMemberHi Chris,
So the revised segment of code would shape up something like this:
woocommerce_quantity_input( array( 'input_name' => 'quantity_' . $ticket->ID, 'input_value' => 0, 'min_value' => 0, 'max_value' => ( $product->get_stock_quantity() < 5 ) ? $product->get_stock_quantity() : 5 ) );
Also how to I keep this from changing if there is an update?
Great question, please follow the instructions in the Themer’s Guide to make this change safely (you can find links to this guide in the menu and in my initial post).
Good luck!
June 22, 2015 at 7:03 am #971837BarryMemberHi!
It’s been a while so I’m going to go ahead and close this topic.
- Need help with anything else? Go right ahead and post a new topic, one of the team will be only too happy to help
- Still need help with this issue and need to re-open it? Again, please simply create a new topic and link to this one to provide the team with some context
Thanks!
-
AuthorPosts
- The topic ‘Limit the number of tickets purchased by email address’ is closed to new replies.