Change ticket number starting value

Home Forums Ticket Products Event Tickets Plus Change ticket number starting value

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1250045
    Tonn Talpsepp
    Participant

    I need to increase the automatically generated ticket number. The client does not want customers to know how many tickets have been sold and thus wants a higher next ticket number. I can change records in the database (e.g. info about the last ticket number generated) to achieve that but please let me know what to change.

    In principle I could “purchase” a large number of tickets and later delete all those to achieve the higher ticket number but there should be a wiser option.

    #1250888
    Cliff
    Member

    Hi, Tonn.

    Where are the ticket numbers being publicly displayed that this would matter?

    Also, I’m assuming you’re using WooCommerce, in which case, are you asking about the WooCommerce Order numbering?

    If you share some annotated screenshots or video screen capture, it might help communicate what you’re seeing and what exactly the issue is.

    #1250972
    Tonn Talpsepp
    Participant

    Ticket number is on the ticket (which is automatically sent to ticket buyers and all ticket buyers see their sequence number). If you are the first to buy tickets you get a ticket with number XXX-1, the second ticket is XXX-2 etc. We want to issue tickets with numbers e.g. XXX-1001, XXX-1002 etc.

    Current situation is that we have issued a small number of tickets (say, that the last one is XXX-10) and we would like to make the system to issue the next ticket with the number XXX-1011, then XXX-1012 etc. This can probably be achieved by changing something in the database because Event Tickets probably holds a reference to the last ticket number in the database and when issuing a new ticket increases the last known reference by 1.

    No, I am not asking about WooCommerce order numbering, it doesn’t have anything to do with my question.

    #1251270
    Cliff
    Member

    That value is stored in the database’s postmeta table with the _unique_id meta_key

    It gets created via get_next_ticket_number() method at Line 110 of /wp-content/plugins/event-tickets-plus/src/Tribe/Meta/Unique_ID.php

    If you look at Line 118, you’re basically wanting $number = 0; to be filterable, such as defaulting to 1000 instead of 0, like this: https://cl.ly/0C0L241w041I

    Is that correct?

    If yes, each following sale is still going to be sequential; is that ok?

    #1251416
    Tonn Talpsepp
    Participant

    Thanks! Changing the number on line 118 helps to start issuing new tickets with a desired number. As I needed to jump from 10 to 1011 then I changed the number on line 120 temporarily to 1001, issued one ticket (which had number 1011) and changed the number on line 120 back to 1. So now ticket numbers will increment by 1 once again and there’re no changes to the code any more. That worked fine!

    #1251475
    Cliff
    Member

    Okay, so something like this should be done at Line 118:

    $number = (int) apply_filters( 'tribe_tickets_plus_inital_ticket_number', 0 );

    Then this should be your code snippet in your theme’s functions.php file, for example:

    https://gist.github.com/cliffordp/91223c67e30e648257e47e50349d81f4

    I tested and this works.

    However, please note that you shouldn’t generally edit core plugin files (which is a major reason for having the filters and actions available throughout WordPress coding).

    And note that if you update Event Tickets Plus plugin, you’ll lose this customization if/until we release a future update that enables this functionality, in which case the filter name could be called something different.

    #1272057
    Nico
    Member

    Hi,

    Just wanted to share with you that maintenance release 4.4.6 of our plugins is out, including a fix for this issue 🙂

    Find out more about the release → https://theeventscalendar.com/maintenance-release-events-calendar-pro-4-4-6-event-tickets-4-4-6-premium-add-ons/

    Please update the plugins and let us know if the fix works for your site,
    Best,
    Nico

    #1283045
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Change ticket number starting value’ is closed to new replies.