May 28, 2022

How to change woocommerce product badge text

https://tamimwahid.com/wp-content/uploads/2020/04/trydo-blog-new-10-3.jpg

Step: Login to WordPress dashboard > and go to the Appearance > themes editor > Find function.php file and open this file > Put the code at the bottom functions.php file

Example: Look at the code here. Changed the “Sale” text to Kampanja. (Change the “Sale!” text to what you want to write in place of kampanja)

Note: If you are using a child theme. It’s better to code implementation. Otherwise, the code is gone when your main theme needs to update or update your theme.

Attached screenshot here:

woocommerce product badge change
WooCommerce Product Badge Change
add_filter( 'woocommerce_sale_flash', 'wc_custom_replace_sale_text' ); 
function wc_custom_replace_sale_text( $html ) { 
return str_replace( __( 'Sale!', 'woocommerce' ), __( 'Kampanja', 'woocommerce' ), $html ); 

}