Skip links

How To Change “Add To Cart” Button Text in WooCommerce

If you work in WooCommerce and sometimes need to change the default button text “Add To cart” in WooCommerce to be more realistic to your web design or your purpose like “Donate Now” or “Purchase Now”.

This code snippet will let you change the text to what you need by using WooCommerce Filter with simple steps

Steps to change “add to cart” button text:

  1. Open WordPress admin panel then go to Appearance > Theme Editor
  2. Open theme Functions.php file, if you work localhost open the same file using any code editor IDE
  3. Add the following code at the bottom of the file.
  4. Save the changes and check your pages as the custom text will show in the single product page or archive pages.

[php]
// Changing add to cart text on single product page
add_filter( ‘woocommerce_product_single_add_to_cart_text’, ‘zytheme_woocommerce_custom_single_add_to_cart_text’ );
function zytheme_woocommerce_custom_single_add_to_cart_text() {
return __( ‘Purchase Now’, ‘woocommerce’ );
}

// Changing add to cart text on product archives page
add_filter( ‘woocommerce_product_add_to_cart_text’, ‘zytheme_woocommerce_custom_product_add_to_cart_text’ );
function zytheme_woocommerce_custom_product_add_to_cart_text() {
return __( ‘Purchase Now’, ‘woocommerce’ );
}
[/php]

Leave a comment

Explore
Drag