How to change Add to Cart text for WooCommerce
Please follow below steps to change the default “Add to Cart” text for WooCommerce
- Go to WordPress admin dashboard
- Go to Appearance
- Go to Theme Editor
- Here if you have a child theme then open functions.php file
- If you don’t have child theme then you can edit file in the main theme (please note the changes will not be upgrade safe, so if you upgrade theme in future, changes will be lost)
- Add below code in functions.php file
Save the changes and check your website. The custom text in add to cart button should show up now.
// Change Add to Cart text for product page
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woocommerce_add_to_cart_text' );
function woocommerce_add_to_cart_text()
{
return __( 'Register Here', 'woocommerce' );
}
// Change Add to cart text on product archive page
add_filter( 'woocommerce_product_add_to_cart_text', 'woocommerce_archive_add_to_cart_text' );
function woocommerce_archive_add_to_cart_text() {
return __( 'Register Here', 'woocommerce' );
}