0

I am using a filter to change a label on a particular page and set the rest the same.

add_filter( 'woocommerce_product_single_add_to_cart_text', 'themeprefix_cart_button_text' ); 
 //Add New Pay Button Text
function themeprefix_cart_button_text() {
    if(is_page(3601)) :
 return __( 'Buy Now', 'woocommerce' );
    else:
return __( 'Add To Cart', 'woocommerce' );
    endif;
}

But not working - anything wrong with the conditional code?

2
  • The code is functionally fine, but are you sure page 3601 is correct, and that the product is a single product? Also is_page() will be checking the ID of the page you're viewing, not the ID of the product whose text you're changing. Is that your intention? Dec 18, 2017 at 6:46
  • Yes definitely a page, id is correct, single product brought in via shortcode
    – neilgee
    Dec 18, 2017 at 11:02

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.