Support

Home Forums Event Espresso Premium Add a go back bottom on Registration Checkout Page

Add a go back bottom on Registration Checkout Page

Posted: September 8, 2015 at 5:22 am

Viewing 3 reply threads


simone

September 8, 2015 at 5:22 am

Hello,

following this useful tutorial, https://gist.github.com/lorenzocaum/6b75d8d2bd516ece27b9 i was able to add a go back button on thank you page adding these lines of codes in functions.php:

add_action( 'AHEE__thank_you_page_overview_template__bottom', 'ee_add_go_back_button_to_thank_you_page' );
function ee_add_go_back_button_to_thank_you_page($transaction) {

    $primary_registrant =  $transaction->primary_registration();
    echo "
    <div class=\"jst-rght\">
    <a class=\"ee-button ee-roundish indented-text big-text\" 
        href=\"".get_post_permalink($primary_registrant->event()->ID())."\">Go back to the ".get_the_title($primary_registrant->event()->ID())."</a>
    </div>
    ";
}

I have to add the same button to the Registration Checkout Page, but i couldn’t find the right action/filter, i have tried with AHEE__SPCO_after_reg_step_form (found at https://eventespresso.com/wiki/ee4-single-page-checkout-page-actions-filters/), but it doesn’t do what i need: i can’t reach the event ID to build the link.
Any suggestions?

Thanks in advance!
Simone


Tony

  • Support Staff

September 9, 2015 at 5:42 am

Hi Simone,

You do need to use the ‘AHEE__SPCO__after_registration_steps’ hook, however you’ll need to pull in the EE transaction separately as it is not passed to the hook.

Something like this:

function ee_display_return_to_event_on_spco(){
    $checkout = EE_Registry::instance()->SSN->checkout();
    if ( $checkout instanceof EE_Checkout ) {
        $transaction = $checkout->transaction;
        if ( $transaction instanceof EE_Transaction ) {
			$primary_registrant =  $transaction->primary_registration();
			echo "
			<div class=\"jst-rght\">
			<a class=\"ee-button ee-roundish indented-text big-text\" 
				href=\"".get_post_permalink($primary_registrant->event()->ID())."\">Go back to the ".get_the_title($primary_registrant->event()->ID())."</a>
		    </div>
		    ";
        }
    }
}
add_action( 'AHEE__SPCO__after_registration_steps', 'ee_display_return_to_event_on_spco' );

Will output the button like this – http://take.ms/bOE83


simone

September 15, 2015 at 10:16 am

Hi Tony,
that is exactly what i need,

sorry for the late of my reply and very thank for your help.

Simone,


Tony

  • Support Staff

September 15, 2015 at 11:03 am

You’re most welcome 🙂

I’ll mark this thread resolved.

Viewing 3 reply threads

The support post ‘Add a go back bottom on Registration Checkout Page’ 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