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.
-
AuthorPosts
-
March 14, 2018 at 9:17 am #1479051altasticParticipant
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.
March 15, 2018 at 10:40 am #1480332SkyKeymasterHi 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,
SkyMarch 15, 2018 at 11:53 am #1480439altasticParticipantYes please add us to the queue – we’ve looked through the code and documentation and can’t find anything to help us.
March 16, 2018 at 11:20 am #1481497SkyKeymasterAllison,
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
March 19, 2018 at 5:57 am #1482856AndrasKeymasterHi 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,
AndrasMarch 23, 2018 at 3:30 am #1486769altasticParticipantI 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.
April 1, 2018 at 4:04 am #1493843altasticParticipantHello,
Please can you help out with the above?
Cheers.
April 4, 2018 at 11:41 am #1496740BarryMemberSorry 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
April 26, 2018 at 9:35 am #1517003Support DroidKeymasterHey 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 -
AuthorPosts
- The topic ‘Programmatically creating tickets’ is closed to new replies.