Help Desk

tribe_get_cost() not changing the event’s cost

  • Posts: 14 Topics: 6
    | Permalink

    Hi,

    I my customized single-event.php I am calling tribe_get_cost() and it is not changing the cost of the event. I have passed in the values in the documentation, but that did not change whether or not it was working. I have also have the Eventbrite plugin. So I am using the

    add_filter( 'tribe_events_admin_show_cost_field', '__return_true', 100 );

    to get the Event Cost on the edit the Event screen. What else can I do to get this working?

    Thanks for the help!
    -Rich

    Posts: 11242
    | Permalink

    Hi Rich. Thanks for your question.

    It looks like you’re using the tribe_events_admin_show_cost_field filter properly.

    When I have just The Events Calendar and Eventbrite Tickets active, that code works and I see this: http://cl.ly/1H3z0E1T2h3y

    Also having Pro activated didn’t affect this screen shot’s display.

    It sounds like you’re aware this filter is specific only to the Add/Edit Event post editor screen in wp-admin.

    If it’s not working for you, please follow our Testing for Conflicts Guide and see if that helps narrow down the cause of this.

    Let us know what you find out.

    Thanks.

    Posts: 14 Topics: 6
    | Permalink

    Hi Cliff,

    I wasn’t clear when I described the issue. My problem is that when I change the event cost on the admin side those changes are not being reflected on the front end after I update the event.

    I changed to the 2015 theme and deactivated all of the plugins except for The Events calendar, Pro, Eventbrite Tickets and Advanced Custom Fields, but that still did not resolve the issue.

    Here is a link to a gist of my template file.

    Thanks for the help.

    -Rich

    Posts: 14 Topics: 6
    | Permalink

    Also I realized that I put the null, true as arguments on the if check on line 64, and have corrected that to be on line 66.

    <span class="event-cost-text"><?php echo tribe_get_cost( null, true ); ?></span>
    Posts: 11242
    | Permalink

    If I understand you correctly, you’re seeing the Event Cost field in the wp-admin post editor for Events, just not seeing it on the front-end single page view of an Event that does have Cost information… and you have this gist file in place in your child theme folder per our Themer’s Guide.

    Ok, so if you have just 2015 theme (without any theme override files, like that gist) and an event with Cost information entered into wp-admin — for an event without any Eventbrite ticket created — does the Cost information show up? It does for me, even without that ‘tribe_events_admin_show_cost_field’ filter code in place: http://cl.ly/1h0u2K0W0X1J

    Posts: 14 Topics: 6
    | Permalink

    Hi Cliff,

    I can see it on the front end of the page. The issue is that with the Eventbrite tickets turned on it will not change the cost of an event.

    I switched to the 2015 theme and turned off Eventbrite Tickets and it worked as expected. I switched back to our custom theme and was able to change the cost of an event and see those changes reflected on the front end without issue. I reactivated the Eventbrite tickets and now when I change the cost the change is not being reflected on the front end. So for example if an event costs $25 if I change the event cost to $50 the front end still says $25. Does this mean it is an issue with the tribe_events_admin_show_cost_field filter?

    Thanks for the help.

    -Rich

    Posts: 4809 Topics: 3 Answers: 6
    | Permalink

    Howdy Rich,

    I can see the confusion caused by this. The cost field is a bit complicated. In our Core plugin we offer the ability to specify the cost of an event. This is basically just a text field that allows you to show if an event has a cover charge. If you get a ticketing addon such as Eventbrite Tickets then we hide that basic cost field from the admin side, and replace it with the EventBrite ticket data.

    The function tribe_events_admin_show_cost_field() is checking to see if it should show this basic cost field. When EventBrite is active it should say no, because this cost field will not reflect the data on EventBrite or its tickets. If you’ve filtered it to return true, strange behavior will result. You can change this field all day long, and it will save to the database, but the info won’t show up on the front end if EventBrite tickets are present. The reason being is because EventBrite is active and so the front end is now reading from the Eventbrite ticket data instead.

    Does that make sense? Does it inform what you’re trying to do? If you have followup questions please fire away. Cheers!

    – Brook

    Posts: 14 Topics: 6
    | Permalink

    Hi Brook,

    It does make sense, that it should be hidden if Eventbrite tickets is implemented. The reason I am using the function is to show an event cost if we are not going register the event with Eventbrite. It seems to take the initial value of the field fine, so do we just need to be aware of the fact that if we cannot change the event cost once it is set up if we are not registering with Eventbrite? I realize that this certainly falls into the edge case category. Thanks for the help.

    -Rich

    Posts: 14 Topics: 6
    | Permalink

    It should also be noted that we are not using the iframe on the page, but are using the plugin so we do not have to register the events in multiple places.

    Thanks,
    Rich

    Posts: 11242
    | Permalink

    Rich, thanks for your replies and understanding of the situation.

    Was there anything more I could help with regarding this thread?

    Posts: 65
    | Permalink

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.