Display how many tickets are left or in stock

Home Forums Ticket Products Event Tickets Plus Display how many tickets are left or in stock

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #944469
    Sabrina
    Participant

    Hi there,

    I set up everything on my website. As I offer classes with a certain amount of minimum attendees, I would like to display how many tickets are in stock (or left).

    Now, one product is sold, but on the overview of the products via woocommerce it also doesn’t show minus one.

    Can you help me?

    Sabrina

    #944539
    George
    Participant

    Hey Sabrina,

    For the first part of your question, are you trying to get the number of tickets left in stock to display on the front-end?

    If so, there is an older forum issue here that may help – see Rob’s initial response to the customer in this ticket, and follow the steps he describes for adding a custom Events view that displays the number of tickets remaining in stock → https://theeventscalendar.com/support/forums/topic/where-is-the-settings-to-show-how-many-tickets-are-left/

    As for the second part of your question, when you mention “the overview of the products via WooCommerce”, do you mean the “Products” page in your admin area? If so, do you mean that the stock value only shows how many tickets there are for sale, not how many tickets have been sold? And if so, is that the data you’re trying to show in addition to the data already there?

    Sorry for any confusion on my part here, or if any of this seems really obvious – I just want to make sure I fully understand your issues so we can help you out as efficiently and accurately as possible! 🙂

    Thanks Sabrina!

    George

    #944561
    Sabrina
    Participant

    Hi George,

    thanks for your response.

    To the first point, about the stock display at the front-end:
    I’ve seen this entry before and tried it. But nothing happened. I did a new folder called “events” in the theme (also child-theme to test it) and put the tickets.php in it. Nothing happened. Do you have another idea how to solve it?

    And now about the stock display at the back-end:

    As for the second part of your question, when you mention “the overview of the products via WooCommerce”, do you mean the “Products” page in your admin area? If so, do you mean that the stock value only shows how many tickets there are for sale, not how many tickets have been sold? And if so, is that the data you’re trying to show in addition to the data already there?

    Point 1:
    When I look on the attendee list for an event, which I definitely sold already one ticket, it shows “no ticket sold” (it says: sold 0 of 12) but in the list there is the attendee. That is really confusing.
    Then, I go to the order page via the WooCommerce menu and see the order in detail. I tried to reduce the stock by stock-action and when I go back to the attendee list for the event, then it says “sold 1 of 11”. But it should be “sold 1 of 12”.

    Point 2:
    The Products page in the admin area shows how tickets are for sale. But I wish there would also be a view how many are sold. It’s important for me to know how many of a specific ticket I sold already, so I can adjust the amount of the other tickets for the same event: like when I offer two tickets for an event to stay overnight. One is for one night and one for two nights and I have a certain amount of beds. I have to adjust the stock for one night as soon as someone buys a ticket for two nights. (or there might be an easier option to solve that, that I don’t know…)

    Thanks for your help.

    #944578
    George
    Participant

    Hey Sabrina,

    I think we should first take care of the issues about how Stock is displayed in your back-end Admin area, then we can extend this into the front-end display of remaining stock.

    I’m curious about the points your brought up here, because for me, things seemed to work well with Stock in the admin.

    First off, I made a test Event and added two tiers of tickets: one “One Nighter” and one “Two Nighter”, with a set amount of stock for both options → https://cloudup.com/cCI1o_JvzJd

    I then went on to buy 2 “Two Nighter” tickets and one “One Nighter” ticket, and in my “Products” WooCommerce view, this is represented fine and clearly for me: https://cloudup.com/ci4NM1EWBRR. Note how I originally had 10 “Two Nighters” for sale, then bought two, and now in Products it says there’s 8 “Two Nighters” left. “One Nighters” works fine as well here, and reflects that one out of 20 in stock has been bought.

    In my attendees list, I do not have the attendees listed there, but do find that it says the tickets are sold. Here’s an example → https://cloudup.com/cA4ifOF_VsM

    However, once I “confirm” the payment within WooCommerce, notice how the attendees list changes to reflect the confirmed WooCommerce order → https://cloudup.com/cX-6Ae2o15u

    So, basically, things in the back-end seem to work find and reflect changing stocks for me completely fine. If you don’t see these similar behaviors, there are a few things I can think of that are worth checking out on your end:

    1. Ensure that you are using the most recent versions of all plugins being used here. The Events Calendar, Events PRO, and Events WooCommerce Tickets should all be at 3.9.1 or 3.9.2, and WooCommerce itself should be 2.3.5
    2. Explore your various plugin settings for The Events Calendar and WooCommerce – have you changed a lot of the options? This is obviously fine to do, and encouraged so that the plugins suit your specific needs, but it’s worth looking over any options you may have set and seeing if there are ones related to stock, stock display, attendees, etc.
    3. If your site is live and the ticket payments are being made by real people with real money, you may be experiencing some “delays” in updates because the system has to wait for all the payments to clear. This depends on the payment methods you’ve enabled and the payment methods used by the customer, and is likely not a factor here, but I’ve seen the delays from needing payments to clear cause confusion in the past and just wanted to mention it
    4. Finally, for now – have you made any code customizations to any of these plugins on your site? If so, does temporarily removing those customizations affect things at all?

    I’m sorry for so much information here Sabrina, but just want to try and best understand exactly what’s going wrong here, because I can’t produce any errors on my local testing site.

    An important thing to point out is that if you expect there to be flexible stock adjustments, changing in real-time based on what tickets are purchased, this currently may not be possible without extensive custom coding.

    And finally, like I mentioned above, I’m not ignoring your front-end requests – that’s a code customization request that I can help with for sure, but I just want to sort out your Admin-facing issues first before working with Stock data.

    Let me know if all this helps at all! Thank you for your patience.

    Cheers,
    George

    #944592
    Sabrina
    Participant

    Thanks for your fast response.

    Finally, the back-end works now. I checked everything twice and saw some things at the product. But it works now and I’m happy with it.

    So, I’m ready for your input about the front-end 🙂

    #944613
    George
    Participant

    Hey Sabrina,

    Glad to hear the back-end is sorted out.

    For displaying things on the front-end how you’d like, you’ll have to take the reins on most of the customization with that because we do not offer support for customizations and such.

    But yes, as promised, here’s at least some example code that you can then take and modify to suit your needs! 🙂

    Check out the example code in this Gist.

    Here’s a screenshot of how that markup looks when generated → https://cloudup.com/cBvxr2mfRb2

    Note that in my example, the function I wrote there called example_displaying_stock_information() is being “hooked” to an action called tribe_events_single_event_after_the_meta() (see line 32 in the Gist). You don’t have to do it this way, you can just drop the function anywhere in your theme where there’s a post loop like so, and get the same result:


    <?php example_displaying_stock_information(); ?>

    And you can change the function name itself, of course, too 🙂

    Take that and play around with it a bit, and note that after the next major update to The Events Calendar, Events PRO, and the WooTickets add-on, you’ll need to change the classnames as follows:

    TribeEvents should become Tribe__Events__Events

    and

    TribeWooTickets should become Tribe__Events__Tickets__Woo__Woo_Tickets

    Best of luck with your site!

    Cheers,
    George

    #945132
    Sabrina
    Participant

    Thank you, George. It works.

    Have a nice retreat with your colleagues.

    #945161
    George
    Participant

    Hey Sabrina,

    Thanks! Make sure to keep a backup of the custom code here so that you don’t lose it if you update things on your site in the future. And if an answer here specifically solved this for you, choose it as the “Correct Answer” if you think of it (you should be able to see this button when you hover over any specific reply).

    Best of luck with your project, cheers!
    George

    • This reply was modified 9 years, 1 month ago by George.
Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Display how many tickets are left or in stock’ is closed to new replies.