• Home
  • how to
  • How to change button text of add to cart woocommerce

How to change button text of add to cart woocommerce

Please Follow the step to change button text of Woocommerce Add To Cart

 

STEP 1

Go to your current  active theme functions.php.

To check the current active theme go to Dashboard  > Appearance > Theme From this you will get the active theme name.

To edit functions.php file goto Dashboard  > Appearance > Theme Editor. Theme Editor will list all the file that present in current theme selected.

click on functions.php file

STEP 2

At the end of the functions.php file Add this code.

add_filter( 'add_to_cart_text', 'freelancedev_custom_single_add_to_cart_text' );               
add_filter( 'woocommerce_product_single_add_to_cart_text', 'freelancedev_custom_single_add_to_cart_text' ); 
  
function freelancedev_custom_single_add_to_cart_text() {
    return __( 'Buy Now', 'woocommerce' );
}

This will change Add to Cart text  to Buy Now on single product page.

To Change the text  on shop page , archives page. Please add this snippet in your functions.php file at the end .

add_filter( 'add_to_cart_text', 'freelancedev_custom_product_add_to_cart_text' );            // < 2.1
add_filter( 'woocommerce_product_add_to_cart_text', 'freelancedev_custom_product_add_to_cart_text' );  // 2.1 +
 
function freelancedev_custom_product_add_to_cart_text() {
    return __( 'Buy Now', 'woocommerce' ); 
}

 

Leave A Reply