[SOLVED] How To Change WooCommerce Button Text

How To Change “Add to Cart” to “Buy Now” WooCommerce Button Text

 

Hello! Today I will teach you how to change the WooCommerce “Add to Cart” button text to “Buy Now” or whatever you want to. For this, you have at least two options:

BEFORE ANYTHING, DO A FULL BACKUP OF YOUR SITE. RIGHT NOW! 

OK, so assuming you did a full backup of your site, in order to change the “Add to Cart” button text to “Buy Now / Order / Hire Me / and so on”, you must add the following PHP code into your theme:

// Change the Add To Cart Button Text on the 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' ); 
}

// Change the Add To Cart Button Text on the 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' );
}

Option 1: Changing the WooCommerce Button Text From The Main Theme:

WP-Dashboard -> Appearance -> Main Theme (the active one) -> Theme editor -> (locate the functions.php file) -> Add the PHP code from above at the bottom of the functions.php page -> Save the file.

If the change doesn’t seems to appear, try to clean your browser cache.


Option 2: Changing the WooCommerce Add to Cart Button Text From The Child Theme (SAFEST METHOD):

This is the safest method, because anytime you’ll update the theme your are using on your WordPress site, the configurations you applied on your site will still be there. If you apply tweaks on the main theme, once you’ll update it, you may lose those tweaks.

Assuming you have the Child Theme activated, go to: WP-Dashboard -> Appearance -> Child Theme (the active one) -> Theme editor -> Functions.php (in fact, I think this is the only file you should see on the child theme) -> Add the PHP code.


Cannot Find The Child Theme Editor In The Dashboard

If you cannot locate the functions.php from the admin dashboard, you can try the following thing:

Go to cPanel -> File Manager -> Public HTML (or the folder where your WordPress Site’ s files are stored) -> WP Content -> Themes -> Theme_Folder (best is to go to Child_Theme_Folder) -> You should see the functions.php there. Open with an editor, paste the code above and save it.

Previous Post
[SOLVED] AdSense werkt niet op mijn WordPress site
Next Post
[SOLVED] WooCommerce Mini Cart Not Update

[SOLVED] Wie kann ich den WooCommerce-Schaltflächentext ändern?

So ändern Sie den Text der Schaltfläche “In den Warenkorb” in “Jetzt kaufen” von WooCommerce

 

Hallo! Heute werde ich Ihnen zeigen, wie Sie den Text der WooCommerce-Schaltfläche “In den Warenkorb” in “Jetzt kaufen” oder was auch immer Sie wollen, ändern können. Hierfür haben Sie mindestens zwei Möglichkeiten:

BEVOR SIE ETWAS UNTERNEHMEN, MACHEN SIE EINE VOLLSTÄNDIGE SICHERUNG IHRER WEBSITE. SOFORT! 

OK, vorausgesetzt, Sie haben ein vollständiges Backup Ihrer Website erstellt. Um den Text der Schaltfläche “In den Warenkorb” in “Jetzt kaufen / Bestellen / Mich einstellen / usw.” zu ändern, müssen Sie den folgenden PHP-Code in Ihr Thema einfügen:

// Change the Add To Cart Button Text on the 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' ); 
}

// Change the Add To Cart Button Text on the 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' );
}

Option 1: Ändern des Textes der WooCommerce-Schaltfläche im Hauptthema:

WP-Dashboard -> Erscheinungsbild -> Hauptthema (das aktive) -> Themen-Editor -> (suchen Sie die Datei functions.php) -> Fügen Sie den PHP-Code von oben am Ende der Seite functions.php ein -> Speichern Sie die Datei.

Wenn die Änderung nicht zu erscheinen scheint, versuchen Sie, Ihren Browser-Cache zu leeren.


Option 2: Ändern des Textes der WooCommerce-Schaltfläche “In den Warenkorb” im Child-Theme (sicherste Methode):

Dies ist die sicherste Methode, denn wenn Sie das Theme, das Sie auf Ihrer WordPress-Website verwenden, aktualisieren, bleiben die Konfigurationen, die Sie auf Ihrer Website vorgenommen haben, erhalten. Wenn Sie Tweaks auf das Haupt-Theme anwenden, können Sie diese Tweaks verlieren, sobald Sie es aktualisieren.

Angenommen, Sie haben das Child-Theme aktiviert, gehen Sie zu: WP-Dashboard -> Erscheinungsbild -> Child Theme (das aktive) -> Theme-Editor -> Functions.php (ich glaube, das ist die einzige Datei, die Sie im Child Theme sehen sollten) -> Fügen Sie den PHP-Code hinzu.


Der Child-Theme-Editor kann im Dashboard nicht gefunden werden

Wenn Sie die functions.php nicht über das Admin-Dashboard finden können, können Sie Folgendes versuchen:

Gehen Sie zu cPanel -> Dateimanager -> Public HTML (oder den Ordner, in dem die Dateien Ihrer WordPress-Site gespeichert sind) -> WP Content -> Themes -> Theme_Folder (am besten gehen Sie zum Child_Theme_Folder) -> Dort sollten Sie die functions.php sehen. Öffnen Sie sie mit einem Editor, fügen Sie den obigen Code ein und speichern Sie ihn.

Previous Post
[SOLVED] AdSense werkt niet op mijn WordPress site
Next Post
[SOLVED] WooCommerce Mini Cart Not Update