Home Forums Event Espresso Premium Event List: Show Price before Surcharge

Event List: Show Price before Surcharge

Posted: November 15, 2013 at 1:08 pm

Devon Boorman

November 15, 2013 at 1:08 pm


I looked through the forum and could not find this topic. I would like to show the price before surcharge on the EVENT_LIST page. That is, if an item is $10 with 5% surcharge, I would like the event list page to show $10, not $10.50. Then when they register they can see the full price in their cart total. I’ve already tweaked the PHP file with a few nice changes, so cutting a pasting code is no problem. Thanks for your help.

Greg Reimer
Academie Duello

Jonathan Wilson

November 17, 2013 at 3:03 pm

Hi Devon,

My EVENT_LIST page doesn’t show a surcharge. The surcharge only appears on the event page. I’ve tried to make it appear in the Event List, but cannot. I’m not sure what settings your have. What add-ons are you using?

Devon Boorman

November 19, 2013 at 12:31 am

I’m working to solve a problem with the way event prices display.

When I do not use the substituted code, the event price does not include the surcharge and shows $10. But it does not show the price at the top (first) of the list.

When I do use the substituted code so that the top (first) price is always shown, it includes the surcharge amount ($10.50) in the price.

So… is there a way I can show the top (first) price in the list and have it not include the surcharge amount? Thanks.

Here’s the page I’m working with (if that helps). Prices that show $63 are actually $60 items that have 5% tax included. I want to show just the $60, which is the first price in the list.



November 19, 2013 at 2:22 am


Not with that shortcode or even the base function it uses as it combines all the costs together.

The only way I can think of getting what you need is via an SQL query.

An alternative option would be to show a price list or price range on the event list:


Devon Boorman

November 19, 2013 at 10:40 am

I’m not too swift on creating SQL queries. Can you offer one? Thanks.

Sidney Harrell

November 19, 2013 at 11:26 am

You can use the code below:

You can add this code to one of the following:
1 – Your theme’s functions.php file. It may get overwritten the next time you update your theme.
2 – The EE custom files add-on in the custom_functions.php file.
3 – Use this blank plugin to hold the custom function.

Devon Boorman

November 19, 2013 at 11:27 am

I’ll try it out. Much appreciated! Thanks.

Devon Boorman

November 19, 2013 at 11:34 am

Well, when I paste it into functions.php it takes down my entire site. Blank white page.



November 20, 2013 at 3:07 am

It is not recommended to test out code changes on a live site, as minor errors in code (we are after all only human) can crash a site.

If you have not done so already, please edit the file where you added the code via FTP and remove the code.

I would suggest using the Plugin idea Sidney said.

Also try this code, it has been modified slightly to remove the error.

function espresso_return_single_price_sans_surcharge($event_id, $number=0) {
		do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, '');
		global $wpdb, $org_options;

		$number = $number == 0 ? '0,1' : $number . ',' . $number;

		$results = $wpdb->get_results("SELECT event_cost FROM " . EVENTS_PRICES_TABLE . " WHERE event_id='" . $event_id . "' ORDER BY id ASC LIMIT " . $number);

		if ($wpdb->num_rows > 0) {
			foreach ($results as $result) {
				if ($result->event_cost > 0.00) {
					$event_cost = $result->event_cost;

				} else {
					$event_cost = '0.00';
		} else {
			$event_cost = '0.00';
				$event_cost = number_format( $event_cost, 2, '.', '');

		return $event_cost;

function get_espresso_price_sans_surcharge_sc($atts) {
	extract(shortcode_atts(array('event_id' => '0', 'number' => '0'), $atts));
	$event_id = "{$event_id}";
	$number = "{$number}";
	echo espresso_return_single_price_sans_surcharge($event_id, $number);
	$buffer = ob_get_contents();
	return $buffer;
add_shortcode('EVENT_PRICE_SANS_SURCHARGE', 'get_espresso_price_sans_surcharge_sc');

Something like this would be used in the event_list_display.php

echo  $org_options['currency_symbol'] . do_shortcode('[EVENT_PRICE_SANS_SURCHARGE event_id="' . $event_id . '" number="0"]');

Please note, that if you do not understand the code or how to add the code, you may need to refer to a web developer for assistance.

Devon Boorman

November 20, 2013 at 9:06 am

Thanks, that did it. You’ve been extremely helpful. Much appreciated.


Sidney Harrell

November 20, 2013 at 11:42 am

Sorry, lost track of the starting and closing braces. I’ve cleaned up the gist on github for any future viewers of this thread.

The support post ‘Event List: Show Price before Surcharge’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3 Documentation for Event Espresso 4

Status: closed

Updated by  Sidney Harrell 6 years, 8 months ago ago

Topic Tags


This topic is: not resolved
Do NOT follow this link or you will be banned from the site!