Numeric Values only for Event Cost field?

Home Forums Calendar Products Events Calendar PRO Numeric Values only for Event Cost field?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #991780
    stephenpatrick
    Participant

    Hello! Our client is having trouble with the Event Cost field. Here is the description of their issue…

    “I noticed that here recently when I type in the area of the price (adding an event) it will only include the first dollar amount and no text. So if I need to enter VIP: $45.00 / Individual: $25.00 it only shows $45.00 as the cost on the posted event. In the past it has allowed us to post the entire text of the cost.”

    Does the cost field require numeric values only or can there be text included as described above?

    Thanks!

    #991853
    George
    Participant

    Hey @stephenpatrick,

    This is indeed by design now, I’m sorry if that’s thrown things off for your client!

    If you’d like to prevent our cost formatting, unfortunately at this time the best way is to manually overwrite the cost formatting with a filter. You can copy and paste this code into your client site’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;
    }

    That should just return the full cost without our new formatting โ€“ย let me know if this helps!

    โ€” George

    #991870
    stephenpatrick
    Participant

    This worked perfectly… thank you!

    #992367
    George
    Participant

    Great! Best of luck with your site ๐Ÿ™‚

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Numeric Values only for Event Cost field?’ is closed to new replies.