hosting tutorials WeChat Top

👋🏼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.

Email Me

(如果你会中文,可以点击微信图标与我联系。)

扫一扫加我

注:因个人英文水平有限,所以暂时只能为懂中文的朋友提供wordpress建站服务

微信:18200592859 或 yrwordpress

Modify the button text on the Woocommerce product list page

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.

【WP-Host/悦然wordpress建站】
2023032307493015

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.

2023032307495958

After the modification is complete, refresh the page to see the effect, as shown in the figure above.

2023032307493015

继续给大家分享wordpress建站教程。之前悦然wordpress建站在做一个wordpress+woocommerce商城网站建设项目,因为客户的产品属性比较多,所以在woocommerce默认产品列表页中,产品的按扭显示文字为【选择选项】,意思是让客户选择对应的产品型号来购买,但是这并不符合我们的日常购物习惯,总觉得有一些奇怪,所以我把这个文字改成了【立即购买】

方法如下:

打开当前wordpress建站主题的functions.php文件,然后把这个文件中添加以下代码,然后保存即可。

//修改woo产品列表页按钮文字【www.zsxxfx.com收集整理】
add_filter('woocommerce_product_add_to_cart_text', 'woo_archive_custom_cart_button_text'); // 2.1 + 

function woo_archive_custom_cart_button_text() { 

    return __('立即购买', 'woocommerce'); 
} 

注意:你可以把上面的【立即购买】改成任何你想要的文字。

2023032307495958

修改完成后刷新页面即可看到效果,如上图所示。

WordPress Hosting / 悦然wordpress建站

WordPress Hosting / 悦然wordpress建站

【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.