👋🏼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.
Modify the button text on the Woocommerce product list page:By default, when a WooCommerce product has multiple pricing attributes, the button on the product card in the WooCommerce product list page will display as “Choose Options”. This is not preferred by many users. Hence, in today’s WordPress tutorial, we will be sharing how to modify the above-mentioned text.
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.
【WordPress Hosting / 悦然wordpress建站】I am a WordPress hobby from China, and I like to communicate with friends from all over the world to learn WordPress website building and maintenance related knowledge.