Programmatically creating tickets

Home Forums Ticket Products Event Tickets Plus Programmatically creating tickets

  • This topic has 0 replies, 4 voices, and was last updated 6 years ago by altastic.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1479051
    altastic
    Participant

    Hello,

    I’ve just updated a site and the original method for programmatically creating a ticket now does not work. When the ticket is added it has 0 capacity and 0 availability and the associated WooCommerce product has a 0 stock level and it says it’s out of stock. When the site was originally built one year ago this all worked but the update has broken this process. Just a note that creating tickets through the UI still works so it’s just using our custom process.

    https://gist.github.com/stompweb/017e02251527185c93c6ddba2838e233

    Please note I am sharing details of the development site – the licensed site is: catpawcinocatcafe.com

    Thanks.

    #1480332
    Sky
    Keymaster

    Hi Allison,

    We are limited in the support we can provide for custom functionality such as this. We need to prioritize support requests from other customers at this time but I’ll certainly flag this with the team and – although we can’t make any promises – if we have time and space to come back and help, we’ll be happy to do so.

    Please let us know if you’d like to go this route so that you can be added to this queue.

    Thanks,
    Sky

    #1480439
    altastic
    Participant

    Yes please add us to the queue – we’ve looked through the code and documentation and can’t find anything to help us.

    #1481497
    Sky
    Keymaster

    Allison,

    Great! I’ve added you to the queue. Hopefully someone will be able to help you figure out what changed soon.

    Thanks for your patience, and let us know if you have any other questions or issues in the meantime.

    Sky

    #1482856
    Andras
    Keymaster

    Hi Allison,

    To get you further with this, we have changed how ticket stocks are handled in the background, likely that is the cause why your current customization is not working.

    In this file you will be able to check what arguments can be passed when creating a ticket.

    wp-content/plugins/event-tickets/src/Tribe/Ticket_Object.php

    My hunch is you are missing some stock related lines. You can try adding:

    $ticket->stock=5;

    and see if that helps you move along.

    Also note that instead of global stock now we are using global capacity. So if you have tickets using that you will likely need to add a couple more lines.

    Let us know how far you get.

    Cheers,
    Andras

    #1486769
    altastic
    Participant

    I have tried adding the stock like this:

    $ticket->stock(8);

    and also like this:

    $ticket->stock = 8;

    And neither seem to do the trick. I’ve also tried setting manage stock to true as well like this:

    $ticket->manage_stock(true);

    But that also had no effect.

    Please can you let me know what the implications of the change from global capacity to global stock are and how it might have impact on this process.

    Is there any documentation on this except for the code?

    Cheers.

    • This reply was modified 6 years, 1 month ago by altastic.
    #1493843
    altastic
    Participant

    Hello,

    Please can you help out with the above?

    Cheers.

    #1496740
    Barry
    Member

    Sorry for the delay, Allison – as mentioned earlier custom development questions like this are generally out of scope and so we can’t guarantee being able to help with them (where we can, there may be added delay). I apologize if that has caused frustration, but I hope you can understand we need to prioritize questions that are within scope 🙂

    In this case, would an alternative approach as outlined in the following snippet work for you?

    https://gist.github.com/barryhughes/b27845f1b39c86d3900bd8df897cda2a

    #1517003
    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 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Programmatically creating tickets’ is closed to new replies.