Making a sales wordpress website using woocommerce plugin is chosen by most of you because it is full of features of an online sales page today and does not need to know the code, just install a few simple steps that you have a full-featured sales website.
But one of woocommerce’s defaults is the “add to cart” button, which will not suit the needs of use, usually you want to modify the word “add to cart” to the words “Buy”, “Order now”, “Buy now”… Or any word at my disposal.
We will then instruct you to add the code to change the “add to cart” button in Woocommerce.
Open the WordPress admin, go to Appearance > Theme File Edit. You should edit in the child theme, it also has a file function.php. Avoiding new updates, all code is lost.
Find and open file functions.php add the bottom code at the end of the function.php
Save the changes and check your website.
// 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 __( 'Mua ngay', '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 __( 'Mua ngay', 'woocommerce' ); }
Change the “Buy Now” text to a word that you feel is appropriate.