Home WooCommerce Tutorials Standard Post

Standard Post

How to Change the Default Add to Cart Button Text in WooCommerce

By default, after installing WooCommerce, the cart button text is „加入购物车“ or „ADD TO CART.“ Some foreign trade websites want to customize this add-to-cart button text for personalization. The method is very simple: just add a piece of code to the theme functions file. The effect is shown below: Implementation method...

Updated on August 14, 2020 About 2 minutes read
修改WooCommerce默认添加到购物车按钮文字的方法

By default, after WooCommerce is installed, the shopping cart button text is „加入购物车“ or „ADD TO CART“. Some foreign trade websites, in pursuit of personalization, want to modify this Add to Cart button text. The method is very simple; just add a piece of code to the theme„s functions file to solve it. The effect is as shown in the image below:

woocommerce添加到购物车按钮改文字

Implementation method: Copy the content below and add it to the theme's functions file.

// 修改单个产品页面的购物车按钮文字
// https://blog.naibabiji.com/woocommerce/change-add-to-cart-button-text.html
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woocommerce_custom_single_add_to_cart_text' ); 
function woocommerce_custom_single_add_to_cart_text() {
    return __( 'Buy Now', 'woocommerce' ); 
}

// 修改产品归档页购物车按钮文字
add_filter( 'woocommerce_product_add_to_cart_text', 'woocommerce_custom_product_add_to_cart_text' );  
function woocommerce_custom_product_add_to_cart_text() {
    return __( 'Buy Now', 'woocommerce' );
}

Modify "Buy Now" in the code above to whatever text you want.

If you want to add an inquiry button to WooCommerce, see the following two articles:

  1. 5 WordPress Inquiry Form Plugins_WooCommerce Email Inquiry Button
  2. Add a Custom Button Below the WooCommerce Add to Cart Button
  3. Several ways to delete and hide the WooCommerce Add to Cart button
3/5 - (3 votes)
Previous Do Foreign Trade WordPress Website Paid Themes and Plugins Need Renewal in the Second Year? Continue reading content around the same timeline. Next Plugins and Code for Adding Emojis to WordPress Comment Box (2020 New Edition) View the next related tutorial or experience.

AI Website Building Assistant

🤖
Hello! I am the Naibabiji AI Assistant. How can I help you?
Quick Consultation: