Created
September 27, 2019 10:11
-
-
Save Pebblo/3a2a6bc12f73a7aeffcee59ade442370 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Example of hot to change the 'Proceed to Finalize Registration' text depending on the cart total. | |
add_filter ( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_finalize_registration_button', 10, 2 ); | |
function ee_finalize_registration_button( $submit_button_text, EE_Checkout $checkout ) { | |
if ( ! $checkout instanceof EE_Checkout || ! $checkout->current_step instanceof EE_SPCO_Reg_Step || ! $checkout->next_step instanceof EE_SPCO_Reg_Step ) { | |
return $submit_button_text; | |
} | |
if ( $checkout->next_step->slug() == 'finalize_registration' ) { | |
if ( $checkout->cart instanceof EE_Cart && $checkout->cart->get_cart_grand_total() != 0 ) { | |
$submit_button_text = 'PAID'; | |
} else { | |
// The total for the cart is 0, so the tickets currently in the cart are all free. | |
$submit_button_text = 'FREE'; | |
} | |
} | |
return $submit_button_text; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment