Menu

WOOCOMMERCE: HOW TO CHANGE “ADD TO CART” BUTTON TEXT?

Hello Guys,
In this post, we will learn how to change the Add to cart button text to Buy Now or anything else. For this, we will write a small snippet code in the function.php file in the theme folder. You can also edit files with the theme editor in the admin panel.

STEPS TO CHANGE DEFAULT ADD TO CART TEXT

Open the WordPress admin panel, go to Appearance > Theme Editor 
Open functions.php theme file
Add the following code at the bottom of the function.php file
Save the changes and check your website. The custom text in add to cart button should show up now.

// To change add to cart text on single product page
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' ); 
}

// To change add to cart text on product archives(Collection) page
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' );
}

Hope this is helpful for you.
Thanks.
Please share your suggestions and issues in the comment. Also, share posts with your friends.

882
Search

Ads