Steps
- Open
functions.php. - Add the code below.
- Save the file.
Done — the default “Add to Cart” text will be replaced with “Buy Now”.
function custom_add_to_cart_text() {
return 'Buy Now';
}
add_filter(
'woocommerce_product_single_add_to_cart_text',
'custom_add_to_cart_text'
);
add_filter(
'woocommerce_product_add_to_cart_text',
'custom_add_to_cart_text'
);