Limit the number of tickets purchased by email address

Home Forums Ticket Products Event Tickets Plus Limit the number of tickets purchased by email address

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #967041
    Chris Blair
    Participant

    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.

    #967168
    Barry
    Member

    Hi 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 🙂

    #967221
    Chris Blair
    Participant

    I 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?

    #967228
    Barry
    Member

    Hi 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!

    #971837
    Barry
    Member

    Hi!

    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!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Limit the number of tickets purchased by email address’ is closed to new replies.