Skip to content

Instantly share code, notes, and snippets.

@GeoffEW
Created July 27, 2016 17:24
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save GeoffEW/69f8a033fb614c78b3de45a197431135 to your computer and use it in GitHub Desktop.
Save GeoffEW/69f8a033fb614c78b3de45a197431135 to your computer and use it in GitHub Desktop.
/* Force the use of the cost field of event and ignore tickets price */
<?php
/* Force the use of the cost field of event and ignore tickets price */
function tribe_just_show_price_field ( $cost, $post_id, $with_currency_symbol ) {
$cost_utils = Tribe__Events__Cost_Utils::instance();
$cost = tribe_get_event_meta( $post_id, '_EventCost' );
if ( $with_currency_symbol ) {
$cost = $cost_utils->maybe_format_with_currency( $cost );
}
return $cost;
}
add_filter( 'tribe_get_cost', 'tribe_just_show_price_field', 10 , 3 );
/* activate event cost field when using event tickets */
add_filter( 'tribe_events_admin_show_cost_field', '__return_true', 100 );
@rami-alloush
Copy link

Great job, this still works better than the official extension!
https://theeventscalendar.com/extensions/show-cost-field/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment