How to change Add to cart text as my own text in Woocommerce

后端 未结 2 1605
我寻月下人不归
我寻月下人不归 2021-01-17 02:39

I am using Woocommerce V2.1.2 in Latest version of wordpress. I have googled, they have given a solution to change in frontend. But I need to change from backend.

K

相关标签:
2条回答
  • 2021-01-17 02:46

    This will change Add to cart button text in woocommerce...

    I am not sure but this will help you in < 2.1 versions...I don't know about 2.1+

    Add this code into your theme's functions.php file.

    add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' );
    //For Single Product Page.
    add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' );
    //For Archives Product Page.
    add_filter( 'woocommerce_product_add_to_cart_text', 'woo_custom_cart_button_text' );
    function woo_custom_cart_button_text()
    {
        return __( 'My Button Text', 'woocommerce' );
    }
    
    0 讨论(0)
  • 2021-01-17 02:58
    add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' );                        
    add_filter( 'woocommerce_product_add_to_cart_text', 'woo_custom_cart_button_text' );
    add_filter('woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text');
    
    function woo_custom_cart_button_text() {
        return __( 'Buy Now', 'woocommerce' );
    }
    
    0 讨论(0)
提交回复
热议问题