Skip to content
Advertisement

Rename “Have A Promotional Code?” in Woocommerce

check please: http://www.baroniarialb.cat/finalitza-la-compra/ I have AVADA and Woocommerce theme installed, but I need to change the “Have A Promotional Code?” and I can’t find the correct code to do it. I have already tried different ways that appear on the internet without success from funtions.php. Could you guide me?

Advertisement

Answer

Try this code. I’ve tested from the my side and it’s working fine

function woocommerce_rename_coupon_field_on_cart( $translated_text, $text, $text_domain ) {
    
    if ( is_admin() || 'woocommerce' !== $text_domain ) {
        return $translated_text;
    }
    if ( 'Apply Coupon' === $text ) {
        $translated_text = 'Put your text here'; //Here add your text which you want to replace
    }
    return $translated_text;
}
add_filter( 'changetext', 'woocommerce_rename_coupon_field_on_cart', 10, 3 );

You can change via jQuery also. Add the script in the footer.php file

<script>
jQuery("h2.promo-code-heading").text("Hello world!");
</script>
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement