skip to Main Content

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?

2

Answers


  1. 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>
    
    Login or Signup to reply.
  2. For strings translations on plugins, we use the locotranslate plugin, simple, fast and can use translated files for more wordpress instances.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search