Posted: 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 |
|
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
|
|
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? |
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? |
|
|
Hi Tony! Thank you very much. That is exactly what I needed. |
Glad we could help 🙂 I’ll mark this thread resolved, please feel free to start anther if you have any other issues/questions. |
|
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.