Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Created September 27, 2019 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/3a2a6bc12f73a7aeffcee59ade442370 to your computer and use it in GitHub Desktop.
Save Pebblo/3a2a6bc12f73a7aeffcee59ade442370 to your computer and use it in GitHub Desktop.
<?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