👋🏼Welcome to my WP-Host blog where I am excited to share my knowledge and expertise on WordPress hosting and website construction tutorials with you. Let’s connect and learn from each other! You can reach me at info@yrshare.com.
Continue to share the WordPress tutorial with you. Recently, 【WP-Host/悦然wordpress建站】 is working on a WordPress+WOOCOMMERCE shopping mall website construction project. Due to the large number of product attributes of customers, the text displayed on the default product list page of WOOCOMMERCE is “Select Options”, which means that customers can choose the corresponding product model to purchase. However, this does not conform to our daily shopping habits, and I always feel a bit strange, So I changed this text to “Buy Now”
Methods as below:
Open the functions.php file of the current wordpress website building theme, then add the following code to this file, and then save it.
//Modify the button text on the WOOCOMMERCE product list page
add_filter('woocommerce_product_add_to_cart_text', 'woo_archive_custom_cart_button_text'); // 2.1 +
function woo_archive_custom_cart_button_text() {
return __('Buy Now', 'woocommerce');
}
Note: You can change the [Buy Now] above to any text you want.
After the modification is complete, refresh the page to see the effect, as shown in the figure above.