Conflict with Fatal error: Call to undefined function add_to_cart_wooticket_btns

Home Forums Ticket Products Event Tickets Plus Conflict with Fatal error: Call to undefined function add_to_cart_wooticket_btns

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #51326
    1vertica
    Participant

    Hi, weird one for you:

    We got everything working great during development on a different theme. After we copied all the overrides in the /theme/events folder, the wootickets plugin stops working. In fact, it breaks aspects of the page at the time when is brought into the page.

    Debugging, it displays this message:

    Fatal error: Call to undefined function add_to_cart_wooticket_btns() in /var/www/vhosts/vertica-careers.com/httpdocs/wp-content/themes/Trim/events/single.php on line 101

    …which is where the is.

    This happens on both the event list and the single event. Swapping back to WP theme and it works fine, but I’ve deactivated all plugins and all javascript files on the TRIM theme and it still happens.

    Any ideas why this happens?

    #51328
    Barry
    Member

    It sounds as if a change you made to your custom events/single.php template is causing a problem (nowhere in the default single events template is add_to_cart_wooticket_btns() called/used) – which would explain why switching to a theme where the same template has not be overriden with the same file would work.

    Is this a customization you made by yourself / are you in contact with whomever set up your custom events templates and can you seek help from them, or else restore the original?

    #51340
    1vertica
    Participant

    Hi Barry,
    It was actually yourself who went in and added.changed some code kindly for us:
    https://theeventscalendar.com/support/forums/topic/list-ticket-price-on-event-list/#post-46758

    Not sure if you remember but you got it working. Was there something specific you changed that we need to copy over?

    #51345
    Barry
    Member

    OK, that’s quite a long and involved thread so it’s definitely possible I’m missing something, but I don’t think I edited your custom events/single.php template (and am not seeing references to that in the other thread).

    If you can highlight the actual change I suggested please do and I’ll take another look.

    #51606
    Barry
    Member

    Hi! Did you get any further on this one?

    #51769
    1vertica
    Participant

    Not yet.
    Looking back at the last thread, you fixed the list.php for us (we copied over the changes single.php) – see May 8th entry here: https://theeventscalendar.com/support/forums/topic/list-ticket-price-on-event-list/.

    It mentioned wrapping the code first:

    echo ‘Pricing data: ‘;
    var_dump($wootickets_pricing);
    tribe_get_ticket_form();
    $price_differential = echo ‘Pricing data: ‘;
    var_dump($wootickets_pricing);

    When we’ve brought over the same code into the live site, it no longer works – which is weird. Just wondering if anything else was changed in another file.

    The issue is definately connected to as both the event list page and the single page break at this point. We thought it may be a javascript conflict but removing all plugins and deregistering the javascript calls in the theme still made no difference.

    Any other ideas what we’re missing here?

    #51770
    1vertica
    Participant

    Sorry, the code was stripped from above. The php causing the issue is here:

    … added to stop it being stripped

    #51771
    1vertica
    Participant

    php add_to_cart_wooticket_btns()

    #51774
    Barry
    Member

    (Please use a service such as Pastebin instead of posting code directly in the forum.)

    So to bring this back to the error you originally reported:

    Fatal error: Call to undefined function add_to_cart_wooticket_btns()

    All I can really tell you is that that is not a function provided by the current version of WooTickets or WooCommerce, so essentially you would need to strip that code out or replace it with something that does work.

    #51830
    1vertica
    Participant

    OK. I noticed in the working version on cvprofessor that there was a function for add_to_cart_wooticket_btns() which looks like this:
    http://pastebin.com/US1wNC3e

    I added this to the vertica-careers site functions.php but it still doesn’t bring in the add to cart button. We also can’t get the price working either. Here’s our current single.php file:
    http://pastebin.com/vnMRz7TY

    The code is the same as cvprofessor but for some reason, it just doesn’t work. What are we missing?

    Thanks for you help so far.
    Phil

    #51841
    Barry
    Member

    Hi Phil,

    The add_to_cart_wootickets_btn() would indeed need to be in your functions.php file – or some other suitable location – before you can use it.

    Please note that however that it will not generate the same WooTickets form as you would normally see when viewing a single event page – it simply creates an add to cart link and so is generally redundant in the context of the events/single.php template (as, if tickets are available, they will be listed in the normal ticket form).

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Conflict with Fatal error: Call to undefined function add_to_cart_wooticket_btns’ is closed to new replies.