Sometimes you might want to change the “add to cart” text of the buttons on your WooCommerce setup. This is very easy to do, and all you need is to copy-paste this snippet inside the functions.php file of your theme (or child theme)

// Change 'add to cart' text on single product page
function wpharvest_add_to_cart_text() {
        return __( 'Add to cart', 'wpharvest' );
add_filter( 'woocommerce_product_single_add_to_cart_text', 'wpharvest_add_to_cart_text' );
// Change 'add to cart' text on archive product page
function wpharvest_archive_add_to_cart_text() {
        return __( 'add to cart', 'wpharvest' );
add_filter( 'woocommerce_product_add_to_cart_text', 'wpharvest_archive_add_to_cart_text' );

Did you find this snippet useful? If so, or if you encountered any issues with it, please let us know in the comments section below.

Published by Dragos Micu


Leave a Reply

Your email address will not be published. Required fields are marked *