skip to Main Content

I have tried different plugins and short codes but nothing works.
At the start it worked fine but then all of a sudden it switched from danish ("Tilføj til kurv"), which is the text i made myself, to english ("Add to cart") and now i can’t change it back.

3

Answers


  1. function custom_add_to_cart_text( $text ) {
        $text = 'Buy Now'; // replace with your text
        return $text;
    }
    add_filter( 'woocommerce_product_single_add_to_cart_text', 'custom_add_to_cart_text', 10 );
    add_filter( 'woocommerce_product_add_to_cart_text', 'custom_add_to_cart_text', 10 );
    

    This one code is used for the update of the add to cart button text.

    Login or Signup to reply.
  2. add_filter('woocommerce_product_single_add_to_cart_text', 'woocommerce_custom_add_to_cart_text'); 
    function woocommerce_custom_add_to_cart_text() {
    return __('Tilføj til kurv', 'woocommerce');
    }
    

    This code goes to your function.php child theme

    Login or Signup to reply.
  3. add_filter( 'woocommerce_product_add_to_cart_text', function( $text ) {
        if ( 'Read more' == $text ) {
            $text = __( 'View Product', 'woocommerce' );
        }
    

    Change the ‘Read more’ on second line to what the current text is in your button. then change ‘EXAMPLE’ to what you wish the text to be. This will not apply to buttons where products are 1. out of stock and 2. variable products

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search