• Resolved Yeshan Perera

    (@yeshansachithak)


    Hi Team,

    I’m using the latest version of WooCommerce. I want to change Add to Basket text to Add to cart. So, I have added below code to my function.php file to change Add to basket text.

    add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' );
    function woo_custom_cart_button_text() {
        return __('Add to cart', 'woocommerce');
    }
    
    add_filter( 'woocommerce_product_add_to_cart_text', 'woo_archive_custom_cart_button_text' );
     
    function woo_archive_custom_cart_button_text() {
        return __('Add to cart', 'woocommerce');
    }

    But, It is not changing the text on add to cart button. However, If I used Add to Cart * with capital C instead of Add to cart the button text are changing.

    Why? and how to change the text as Add to cart without capital C?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Fernando a11n

    (@fhaps)

    Automattic Happiness Engineer

    Hi Yeshan,

    By default Add to cart is the text used in WooCommerce. Is it possible that the theme you are using is overriding this? You could check by switching to a different theme and checking what is the displayed text then.

    A plugin that I could recommend to try and edit these strings is Loco Translate. While this is mainly used to create different language translations, it can also be used to edit the text strings within the same language.

    I hope this helps,
    Fernando

    Thread Starter Yeshan Perera

    (@yeshansachithak)

    Thank you @fhaps. Yes, it is something to do with my current template.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add to Basket text is not changing’ is closed to new replies.