Skip to content

Instantly share code, notes, and snippets.

@vicskf
Forked from GeoffEW/force_cost.php
Last active March 8, 2019 18:47
Show Gist options
  • Save vicskf/bb992948b3a8d4adb67549479433f708 to your computer and use it in GitHub Desktop.
Save vicskf/bb992948b3a8d4adb67549479433f708 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( 'tec.cost-utils' );
$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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment