By default, WooCommerce does not provide a built-in option to change the Add to Cart button text. However, depending on your business needs, you may want to customize it, for example, to display “Buy Now”, “Add to Bag” or other action-focused labels.
Snippet: Change Add to Cart Button Text on Shop, Archive/Category Pages & Single Product Pages
Use the following snippet to change the Add to Cart button text across the shop, product archive/category pages and single product pages:
// Change Add to Cart Button Text on Shop & Archive/Category Pages
add_filter( 'woocommerce_product_add_to_cart_text', 'shez_change_add_to_cart_text_archives', 9999 );
function shez_change_add_to_cart_text_archives() {
return esc_html__( 'Buy Now', 'woocommerce' );
}
// Change Add to Cart Button Text on Single Product Page
add_filter( 'woocommerce_product_single_add_to_cart_text', 'shez_change_add_to_cart_text_single', 9999 );
function shez_change_add_to_cart_text_single() {
return esc_html__( 'Buy Now', 'woocommerce' );
}Where to add this custom code?
Add this code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin.
Related Snippets:
About Sheraz Ghani
Hey, I’m Sheraz, a WordPress developer who codes every day, and I share what I learn so other developers don’t have to figure it out the hard way.
Shez.dev is where I document useful WordPress code snippets, troubleshooting guides and developer tutorials.
Need some developer help? Contact me