Support

Home Forums Custom Files Add-on (EE3) EE3 Hide Invoice Payment Option Button for an Event

EE3 Hide Invoice Payment Option Button for an Event

Posted: June 1, 2015 at 10:29 am

Viewing 5 reply threads


Racheal A

June 1, 2015 at 10:29 am

Hi-

I know this has been topic of many posts, but I couldn’t find specifically what I was looking for. I have EE3. I would like to hide the Invoice Payment Option Button for just one of my events. Can you tell me the best way to accomplish this? I saw an example of code you could use for PayPal. Can you please give me the code you would use for the Invoice Payment Option? I really appreciate it. Thanks in advance.

Racheal


Dean

June 1, 2015 at 11:39 am

Hi,

Based on this function (https://gist.github.com/joshfeck/6768792) you would use it this way:

function htrappfae_remove_paypal_from_event($payment_data) {
  extract( $payment_data );
  if ( $event_id==4 ) { //check to see if this is the event with the ID of #74
    remove_action( 'action_hook_espresso_display_offline_payment_gateway', 'espresso_display_invoice' );
  }
}

add_action ( 'action_hook_espresso_display_offline_payment_gateway', 'htrappfae_remove_paypal_from_event', 9 );

Where $event_id==4 change the 4 to the event ID number found in the event overview

  • This reply was modified 9 years, 5 months ago by Tony. Reason: Just added some nicer formatting to the code


Racheal A

June 1, 2015 at 12:10 pm

Thanks for the quick response! This hides the PayPal button. Would you just basically swap the “paypal” with “invoice” and vice-versa to hide the Invoice payment option?


Tony

  • Support Staff

June 2, 2015 at 4:05 am

Hi Racheal,

Although the code @Dean provided was originally intended for PayPal, he has modified how the function works to remove the invoice. Here is an updated version that just swaps out the function name for invoice:

function htrappfae_remove_invoice_from_event($payment_data) {
  extract( $payment_data );
  if ( $event_id==360 ) { //check to see if this is the event with the ID of #360
    remove_action( 'action_hook_espresso_display_offline_payment_gateway', 'espresso_display_invoice' );
  }
}
add_action ( 'action_hook_espresso_display_offline_payment_gateway', 'htrappfae_remove_invoice_from_event', 9 );

The important parts are:

$event_id==360

That’s your specific events ID, and then this line:

remove_action( 'action_hook_espresso_display_offline_payment_gateway', 'espresso_display_invoice' );

Which removes the call to display the invoice ‘espresso_display_invoice’ from within the ‘action_hook_espresso_display_offline_payment_gateway’ action.

Both this code and the code Dean provided should do the same function and remove the Invoice from the offline payment methods.

Without the function: http://take.ms/033Stf

With the function: http://take.ms/pAkz6

Does that help?


Racheal A

June 2, 2015 at 8:35 am

Hi Tony! Thank you very much. That is exactly what I needed.


Tony

  • Support Staff

June 2, 2015 at 9:59 am

Glad we could help 🙂

I’ll mark this thread resolved, please feel free to start anther if you have any other issues/questions.

Viewing 5 reply threads

The support post ‘EE3 Hide Invoice Payment Option Button for an Event’ 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