WOOCOMMERCE | change “add to cart ” text .

January 17th, 2018

I need to change the “add to cart ” button text on single product page and on archive page.

For do that :

  • 1° Open functions.php from you theme folder
  • 2° scroll down till the end of the file and paste this for single product :
    <?php
    // Change 'add to cart' text on single product page
    add_filter( 'woocommerce_product_single_add_to_cart_text', 'choose_add_to_cart_text_single' );
    function choose_add_to_cart_text_single() {
            return __( 'add to cart custom', 'choose_woocommerce' );
    }
    
  • And this for archive page :
    <?php
    // Change 'add to cart' text on archive product page
    add_filter( 'woocommerce_product_add_to_cart_text', 'choose_add_to_cart_text_archive' );
    function choose_add_to_cart_text_archive() {
            return __( 'add to cart custom archive', 'choose_woocommerce' );
    }
    
  • Re upload function.php
  • Reload Page

That’s all.