Remove price on individual events, but not globally

Home Forums Calendar Products Events Calendar PRO Remove price on individual events, but not globally

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1031866
    Karen
    Participant

    Hello
    I’ve seen other people asking how to remove the price from events and the resolution has been via CSS. I also need to remove the event price, however, I only need to do it on a few specific events, so globally changing the CSS won’t work for me. Is there a way for me to remove all display of pricing on individual events? OR is it possible to show custom text there instead of a number, for instance “N/A” or “Private Session” ?

    Thanks
    Karen

    • This topic was modified 10 years, 5 months ago by Karen.
    #1032549
    George
    Participant

    Hey @Karen!

    Removing the cost field outright is a bit tricky, especially if it’s only for some certain events and not globally – however, you mention that allowing non-numeric values like “N/A” would be helpful too:

    OR is it possible to show custom text there instead of a number, for instance “N/A” or “Private Session”?

    The good news here is that YES this is possible! 🙂 It will unfortunately take some code customization, but it’s easy – just copy and paste the following snippet into your theme’s functions.php file:


    add_filter( 'tribe_get_cost', 'cost_show_full_meta_field', 10, 2 );

    function cost_show_full_meta_field( $cost, $post_id ) {
    $full_cost = tribe_get_event_meta( $post_id, '_EventCost', false );

    if ( isset( $full_cost[0] ) ) {
    return sanitize_text_field( $full_cost[0] );
    }

    return $cost;
    }

    This will let values like “N/A” or “Contact for Details” or whatever be used as the “price”, without hindering the existing function of using numeric values like “$10.00” and all that.

    I hope this helps!

    — George

    #1075833
    Support Droid
    Keymaster

    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.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Remove price on individual events, but not globally’ is closed to new replies.