• Resolved kstiehl

    (@kstiehlhotmailcom)


    Hi,

    We want to change this message that appears when the user lands on the site using the coupon code in the url ex: https://www.site.com/?apply_coupon=xx:
    “COUPON ‘xx’ WILL BE APPLIED WHEN IT’S CONDITIONS ARE MET”

    Is there an easy way to customize this message without modifying the code in the plugin, like with a function?
    We are using the PRO version of the plugin and it is not an Auto coupon.
    Thanks

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Soft79

    (@josk79)

    Please see the snippet at this thread

    Thread Starter kstiehl

    (@kstiehlhotmailcom)

    Hi,

    Unfortunately adding the script to the function.php file of my child theme didn’t work. If it changes anything, it is Not and autocoupon. I’m still getting this message when the user lands on the site:
    COUPON ‘COUPON10’ WILL BE APPLIED WHEN IT’S CONDITIONS ARE MET.

    Just in case I misunderstood, i substituted the line:
    $ my_coupon_code = ‘my_coupon_code’;
    for $ my_coupon_code = ‘coupon10’;

    And I tried putting the coupon code in upper and then lower case in the php.
    Any other suggestions?

    Thanks

    Plugin Author Soft79

    (@josk79)

    It should be functions.php, not function.php

    Thread Starter kstiehl

    (@kstiehlhotmailcom)

    Yes, sorry it was the functions.php file. I used the WordPress editor. I also tried it on the parent theme…still nothing.

    Plugin Author Soft79

    (@josk79)

    Can you send me the url?

    Thread Starter kstiehl

    (@kstiehlhotmailcom)

    Plugin Author Soft79

    (@josk79)

    The coupon code is mm10, not coupon10. Please edit the snippet so it reads:

    add_filter( 'woocommerce_add_message', function( $message ) {
    
    	$my_coupon_code = 'mm10';
    	$my_coupon_message = 'Your discount was applied; add products to your shopping cart to see your savings.';
    
    	if ( $message == sprintf( __( 'Coupon \'%s\' will be applied when it\'s conditions are met.', 'woocommerce-jos-autocoupon' ), $my_coupon_code ) ) {
    		$message = $my_coupon_message;
    	}
    
    	return $message;
    }, 10, 1 );
    
    • This reply was modified 8 years ago by Soft79.
    • This reply was modified 8 years ago by Soft79.
    Thread Starter kstiehl

    (@kstiehlhotmailcom)

    Thanks. It works perfectly of course. Have a great day! ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Apply coupon with url message’ is closed to new replies.