Class ‘WC_Product’ not found error

Home Forums Ticket Products Event Tickets Plus Class ‘WC_Product’ not found error

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1161655
    tuberb
    Participant

    We are using The Events Calendar Pro with Easy Digital Downloads as the shopping cart and have only just switched over to Events Tickets Plus from EDD Tickets.

    If a visitor has previously registered for an event and goes back to the event detail page, they now have a link in their sidebar that says “You have 1 Ticket for this Event. View your Tickets”. Two questions about that:

    1. How can we disable that? I looked in your online documentation but could not find anything to suggest where it can be removed.

    2. If someone clicks on the link, we get an error: “PHP Fatal error: Class ‘WC_Product’ not found in /home/itsma/public_html/wp-content/plugins/event-tickets-plus/src/views/tickets-plus/orders-tickets.php on line 74”. We are not using WooCommerce so I assume this is a bug in the code that tries to reference that class even though we are using Easy Digital Downloads.

    Thanks,

    Barry

    #1161751
    Geoff B.
    Member

    Good evening Barry and welcome back!

    Thank you for reaching out to us.

    We are sorry to hear about these 2 issues you are experiencing on your website.
    I would love to help you with this topic.

    As a first troubleshooting step, could you please provide us with your complete system information in a private reply using the instructions found in the following link?

    https://theeventscalendar.com/knowledgebase/sharing-sys-info/

    1. How can we disable that? I looked in your online documentation but could not find anything to suggest where it can be removed.

    Ideally, I would need to be able to replicate this on my end to help out.
    But, to get started, would it be possible to create a dummy customer account for me where this issue happens ?

    Once that is done, I would simply need the dummy customer’s credentials in a private reply.

    2. If someone clicks on the link, we get an error: “PHP Fatal error: Class ‘WC_Product’ not found in /home/itsma/public_html/wp-content/plugins/event-tickets-plus/src/views/tickets-plus/orders-tickets.php on line 74”. We are not using WooCommerce so I assume this is a bug in the code that tries to reference that class even though we are using Easy Digital Downloads.

    Can you confirm if you went through the following process as you migrated from EDD tickets to Event Tickets Plus : https://theeventscalendar.com/knowledgebase/moving-to-event-tickets-plus/ ?

    Best regards,

    Geoff B.

    #1161768
    tuberb
    Participant

    Why do I need to provide you with system information in order to be able to be told how to disable this feature from inside our theme? You have all sorts of actions and filters that we use in lots of places; I just can’t find the one that controls this new feature in your documentation.

    And yes, we went through the process to migrate to Events Tickets Plus that is outlined in that article. But even though everything critical related to the shopping cart is working fine, we get this error, that I assume relates to WooCommerce, where we are using Easy Digital Downloads as the cart.

    Barry

    #1162363
    Geoff B.
    Member

    Good afternoon Barry,

    Thank you for writing back.

    Why do I need to provide you with system information in order to be able to be told how to disable this feature from inside our theme?

    That is a great question. The system information provides us with the ability to reproduce a similar setup to yours as we are trying to replicate your issue.

    Additionally, this speeds up the time it takes to find new bugs (if any).
    In your specific case, there is at least one potential bug (point #2).

    The good news is that you can keep this information private by using the “Set as private reply” option.

    You have all sorts of actions and filters that we use in lots of places; I just can’t find the one that controls this new feature in your documentation.

    You are right. The most robust way to tackle this would be through a template customization.
    You might want to read our Themer’s guide to get a sense of how that works.

    Additionally, you can simply hide this with CSS

    .tribe-link-tickets-message {
    display: none;
    }

    But even though everything critical related to the shopping cart is working fine, we get this error, that I assume relates to WooCommerce, where we are using Easy Digital Downloads as the cart.

    This is what I would like to find out, but my hands are a bit tied without the system information or the credentials to run some tests.

    As it stands, I am unfortunately unable to reproduce this.

    Best regards,

    Geoff B.

    #1162374
    tuberb
    Participant

    Ok, I had already looked at the documentation and the themers guide, but I can’t find the hook that controls this particular new feature of Events Tickets Plus, which is why I asked the question here. Please look at the attached graphic showing what we are seeing on the event detail page and point me to the function that can be used to disable it. This is not a bug, just a new feature that we do not want, especially since we get an error when users access it.

    As far as the error is concerned, I searched for the string ‘WC_Product’ in the codebase for Events Tickets Plus. It is found in 3 scripts: \Src\Tribe\Commerce\WooCommerce\Main.php, \Src\Views\tickets-plus\orders-tickets.php and \Src\Views\wootickets\Tickets.php.

    I assume Main.php, that declares the class, is only invoked if the site is using WooCommerce. In Tickets.php the class is referenced only after a test to see if it exists, which it would not for our site since we don’t use WooCommerce. In orders-tickets.php, which is where we are seeing the error in our site, the class is referenced without testing to see if it exists. So that seems to be to be a bug in your code.

    And you should be able to reproduce the error on any site that uses Easy Digital Downloads as the shopping cart, without needing any credentials from our site.

    Barry

    #1163239
    Geoff B.
    Member

    Good evening Barry,

    Thank you for writing back and for taking the extra time to investigate this further.
    This will certainly help us deal with what indeed looks like a bug.

    I did some additional research on this and the link itself is not generated by a function per se, but rather by a variable ($message).
    You can find the code in /event-tickets/src/views/tickets/orders-link.php at lines 45-50.

    Hopefully this will help you filter out the functionality.

    And you should be able to reproduce the error on any site that uses Easy Digital Downloads as the shopping cart, without needing any credentials from our site.

    I completely understand and respect your desire to keep information private.

    We will perform additional tests on our end and update you with any findings we come across.

    Best regards,

    Geoff B.

    #1164288
    Geoff B.
    Member

    Good evening Barry,

    I am just following up on this to let you know that a bug ticket has indeed been opened.

    In the meantime, I have 2 extra workarounds for you:

    1. Create a blank file at [some-theme]/tribe-events/tickets/orders-link.php
    2. Use the following snippet in your theme’s functions.php https://gist.github.com/GeoffEW/303a051428692899e3ed6eb6cabd7cd0

    Unfortunately, I cannot commit to a release date for the bugfix at this point. But stay tuned, you will be contacted when fix is released.

    Best regards,

    Geoff B.

    #1173300
    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 ‘Class ‘WC_Product’ not found error’ is closed to new replies.