I currently have this in my functions.php to change the default order button text in woocommerce.

add_filter( 'woocommerce_order_button_text', 'woo_custom_order_button_text' ); 

function woo_custom_order_button_text() {
    return __( 'Join The Founders Circle', 'woocommerce' ); 

This is working great. I'm working on a single product checkout page and i'd like to keep that code above for the other products except the new checkout page.

I know i need to target that page only and use conditional logic to do so, but everything i'm trying isn't working and this isn't my strong point. Can anyone help?

The Page ID of the new checkout is 37802.

Thanks in advance!!!!!!!

1 Answer 1


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' );   


The conditional logic is_page() does not work.

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.

Instead of page checking, i suggest you check if the desired product is in the cart, if so, show other order button text.


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

  • here is what i took from your code. It works briefly, and then gets over ridden with the join the founders circle. can i add priority to the return somehow? add_filter( 'woocommerce_order_button_text', 'woo_custom_order_button_text' ); function woo_custom_order_button_text() { if( ! is_page(37802)) { // only run if page ID is 37802 return __( 'Join The Founders Circle', 'woocommerce' ); } return __( 'Join The Retreat', 'woocommerce' ); } Jun 9, 2018 at 2:15
  • do not include large code snippets in comments, it's very hard to read.. See my updated answer. Do you still have your old code snippet active?
    – Bjorn
    Jun 9, 2018 at 2:25
  • Bjorn, sorry new to stackexchange... not sure how to do code like you did! I did remove the old snippet. I really appreciate your help in getting this rolling. i recorded a quick loom on what is happening, if you have any ideas awesome, if not i might have to dig into woocommerce support. useloom.com/share/3fb5beee03a9417695571796448861ef thanks again! i really appreciate you! Jun 9, 2018 at 2:39
  • I have edited your question, please accept my changes. I see the vid and kinda know whats going on, i'll investigate and let you know.
    – Bjorn
    Jun 9, 2018 at 2:43
  • Ok, so i'm a bit confused, what do you mean by single product checkout page, this is not a default WOO option? Are you using a plugin for this? If so, which plugin? btw, i did not mean accept my answer ^^. I have made changes to your Question, please accept those changes ;-).
    – Bjorn
    Jun 9, 2018 at 3:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.