Repository Forums Support WooCommerce Extended Coupon Features PRO Creating an override custom error message

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #18889
    Jack Ball
    Participant

    Hi,

    I am wanting to change the current error message “coupon ‘…’ will be applied when its conditions are met” for all my coupons, I know I can do itin the front end however I have many coupons and are continually adding them, is there a way to change it?

    #18890
    Soft79
    Keymaster

    You can use the ‘woocommerce_coupon_error’-filter for that. You can take a look at the source code of our plugin for inspiration.

    #18891
    Jack Ball
    Participant

    What directory is the source code for this in your plugin?

    #18892
    Soft79
    Keymaster

    /pro/plugins/WJECF_Pro_Coupon_Queueing.php

    #18893
    Soft79
    Keymaster

    Looking further, I think the WC filter to override our meta-value ‘_wjecf_enqueue_message’ would be easier to implement. Something like this:

    
    add_filter(
      'woocommerce_coupon_get__wjecf_enqueue_message',
      function( $value, $coupon ) {
        return 'THE MESSAGE YOU WOULD LIKE TO SHOW';
      }, 10, 2 );
    

    (Snippet has not been tested)

    This filter is defined in WooCommerce here: https://github.com/woocommerce/woocommerce/blob/e9e382adf8509ae407c68cc5ebef378f29de8cdc/plugins/woocommerce/includes/abstracts/abstract-wc-data.php#L352

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.