// Change WooCommerce button text on shop and archive pages
add_filter( ‘woocommerce_product_add_to_cart_text’, ‘custom_woocommerce_product_add_to_cart_text’ );
add_filter( ‘woocommerce_product_single_add_to_cart_text’, ‘custom_woocommerce_product_add_to_cart_text’ );
function custom_woocommerce_product_add_to_cart_text( $text ) {
return ‘Buy Now’;
}
// Change text for variable products
add_filter( ‘woocommerce_product_single_add_to_cart_text’, ‘custom_variable_product_text’ );
add_filter( ‘woocommerce_product_add_to_cart_text’, ‘custom_variable_product_text’ );
function custom_variable_product_text( $text ) {
return ‘Buy Now’;
}
// Change “Read more” and “Select options” button text on loop (archives)
add_filter( ‘woocommerce_product_add_to_cart_text’, ‘custom_loop_product_button_text’, 20, 2 );
function custom_loop_product_button_text( $text, $product ) {
if ( ! $product->is_purchasable() || ! $product->is_in_stock() ) {
return ‘Buy Now’;
}
switch ( $product->get_type() ) {
case ‘simple’:
case ‘variable’:
case ‘grouped’:
case ‘external’:
return ‘Buy Now’;
default:
return ‘Buy Now’;
}
}