Event Tickets Plus & WooCommerce – Only allow a ticket to be purchased once ever

Home Forums Ticket Products Event Tickets Plus Event Tickets Plus & WooCommerce – Only allow a ticket to be purchased once ever

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1112104
    rtandoh
    Participant

    Hi,

    I am using Event Tickets Plus with WooCommerce and have the requirement to allow a particular ticket to only ever be purchased once, i.e. per event, not per transaction. My use case is that members on my site get one free ticket per event.

    I have found code that prevents repeat WooCommerce orders – https://www.skyverge.com/blog/prevent-repeat-purchase-with-woocommerce/ – but because Event Tickets Plus WooCommerce tickets are not displayed via the normal shop page, it doesn’t work.

    Could you provide any direction as to how I might get the above code – or similar – to work, so I can satisfy my requirement?

    Thanks,
    Richard

    #1112151
    George
    Participant

    Hey Richard,

    Thanks for reaching out!

    While we unfortunately cannot assist with plugins we don’t make or with writing/modifying custom code, if you are only trying to sell one single ticket for an event, why not just set the “Quantity” available of the ticket to 1?

    This should work well and will only allow 1 ticket to be sold. Here is a screenshot of setting the ticket stock to 1, for reference:

    Cheers,
    George

    #1112157
    rtandoh
    Participant

    George,

    Thank you for the very prompt response. Rereading my question, I see I wasn’t as clear as I should have been. Apologies. I want to limit it to one ticket per buyer per event rather than just one ticket per event.

    I run a membership network and paid members get one free ticket to each of our events. I want to make sure that once they have requested a ticket for a given event, they can’t request another.

    I know you don’t assist with plugins you don’t make or with writing/modifying custom code, but I’d appreciate, as you have done for others, some guidance re. where in your Event Tickets Plus codebase I would find the code that outputs the event ticket dropdowns.

    Cheers,
    Richard

    #1112377
    George
    Participant

    Hey Richard,

    Thanks for clarifying things a bit! This is unfortunately not possible out-of-the-box with any of our plugins:

    I want to limit it to one ticket per buyer per event rather than just one ticket per event.

    In regards to helping with custom code, I’m definitely happy to try and at least point you in the right direction here!

    To that end, you go on in your reply to establish this as a goal of yours:

    I want to make sure that once they have requested a ticket for a given event, they can’t request another.

    It sounds like some sort of limitation could be put in place here in a bit of a roundabout way. What I mean is, instead of a “true” solution where the code looks for membership status and limits the actual “selectability” of quantity of tickets, you could do something like this instead:

    • Make it so that only one ticket is ever selectable regardless.
    • For any logged-out users, hide the ticket purchase form.
    • For any logged-in users, when viewing an event, check to see if they already have a ticket to the event. If so, hide the ticket purchase form; if not, then leave the ticket purchase form open for use to them.

    Each thing here is a non-trivial customization to make, so not to belabor a point you already know, but you will have to take the reins on most of the implementation here. As an example/clever workaround for pulling off the first part alone, for example—which is one of the simplest components of this!—you could add the code in the following Gist to your theme’s functions.php file ? https://git.io/vrfJE

    Now for the second part, which is again a bit simple (relatively). This bit of code will help hide the carts by default for any user who is not logged-in. To do this, add CSS like the following to the bottom of your theme’s style.css file:


    .type-tribe_events form.cart {
    display: none !important;
    }
    body.logged-in .type-tribe_events form.cart {
    display: none !important;
    }


    Now the Tricky Stuff

    I hope the above code I’ve written for you helps! You will have to take the reins from here, and there are two main complications worth highlighting here:

    1. Code in themes gets overwritten every time you update your theme. So you will have to re-implement the code after each theme update, or create a child theme, which you can read about there.

    2. Wiring up the third component here is the trickiest part, and you will likely need to work with custom coding from both you membership plugin/system and the Event Tickets Plus ticketing functionality. If you don’t feel comfortable making such edits on your own, hiring a developer to assist you might be a great option. We have a list of great developers here → http://m.tri.be/18k1 (and we have no affiliation with any of these folks–they’re simply some well-respected names in the community that we’ve compiled).


    Best of luck with your customizing and tinkering!
    George

    #1118265
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Event Tickets Plus & WooCommerce – Only allow a ticket to be purchased once ever’ is closed to new replies.