Support

Home Forums Event Espresso Premium Credit card only for only two events

Credit card only for only two events

Posted: November 14, 2013 at 8:50 pm

Viewing 2 reply threads


bwilcox

November 14, 2013 at 8:50 pm

Hi There,

We currently accespt both credit card through the stripe gateway as well as check and money order. For two of our upcoming events we need to change to accepting just stripe for those events only. I came accross this in your support forum https://eventespresso.com/topic/different-payment-gateways-for-different-events-2/ which pointed me to adding the following to my theme’s functions.php

[code language=”php”]
function htrappfae_remove_check_from_event($payment_data) {
extract( $payment_data );

if ( $event_id==74 OR $event_id==60) { //check to see if this is the event with the ID of #74
echo “Event Espresso ID: $event_id”;
remove_action( ‘action_hook_espresso_display_offline_payment_gateway’,’espresso_display_check’,9 );
}
}

add_action ( ‘action_hook_espresso_display_offline_payment_gateway’, ‘htrappfae_remove_check_from_event’,9 );
[/code]

I am able to tell that the function is working somewhat as it echos the Event ID for the two events we would like to change but the check/money order payment option is still showing up. Any help you can provide would be greatly appreciated.

  • This topic was modified 11 years ago by bwilcox.
  • This topic was modified 11 years ago by bwilcox.
  • This topic was modified 10 years, 12 months ago by bwilcox.


bwilcox

November 14, 2013 at 8:53 pm

[code language=”php”]
function htrappfae_remove_check_from_event($payment_data) {
extract( $payment_data );

if ( $event_id==74 OR $event_id==60) { //check to see if this is the event with the ID of #74
echo “Event Espresso ID: $event_id”;
remove_action( ‘action_hook_espresso_display_offline_payment_gateway’,’espresso_display_check’,9 );
}
}

add_action ( ‘action_hook_espresso_display_offline_payment_gateway’, ‘htrappfae_remove_check_from_event’,9 );
[/code]


Dean

November 15, 2013 at 12:56 am

Hi,

The gateway code has changed slightly since that point. The code would now look like this:

function htrappfae_remove_check_from_event($payment_data) {
  extract( $payment_data );
    if ( $event_id==8) { //check to see if this is the event with the ID of #74
        //echo "Event Espresso ID: $event_id";
        remove_action('action_hook_espresso_display_offline_payment_gateway_2','espresso_display_check' );
        remove_action('action_hook_espresso_display_offline_payment_gateway_2', 'espresso_display_purchase_order');
    }
}

add_action ( ‘action_hook_espresso_display_offline_payment_gateway’, ‘htrappfae_remove_check_from_event’,9 );

Please note that if you want to do this with other gateways, you will need to check the action hook in each gateway as they may well be slightly different (e.g. invoice doesn’t currently have the _2 at the end).

Viewing 2 reply threads

The support post ‘Credit card only for only two events’ 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.

Event Espresso