You can try the following
add_filter( 'woocommerce_order_button_text', 'woo_custom_order_button_text', 999 );
function woo_custom_order_button_text() {
if( is_page(37802)) { // only run if page ID is 37802
return __( 'Join The Retreat', 'woocommerce' );
}
return __( 'Join The Founders Circle', 'woocommerce' );
}
UPDATE
The conditional logic is_page()
does not work.
WHY
Because on the checkout page, WOO uses ajax to update almost everything on the page, including the order button. When ajax is called, it runs in an admin session, so is_page()
does not work.
SOLUTION
Instead of page checking, i suggest you check if the desired product is in the cart, if so, show other order button text.
Example
add_filter( 'woocommerce_order_button_text', 'woo_custom_order_button_text', 999 );
function woo_custom_order_button_text() {
$product_id = 179; // Some product id
$product_cart_id = WC()->cart->generate_cart_id( $product_id );
// Returns an empty string, if the cart item is not found
$product_in_cart = WC()->cart->find_product_in_cart( $product_cart_id );
if( $product_in_cart ) {
return __( 'Buy our special product', 'woocommerce' );
}
return __( 'Buy product', 'woocommerce' );
}
Regards, Bjorn