Repository Forums Support WooCommerce Extended Coupon Features PRO Add Products Name is message

Topic Resolution: Resolved
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #971


    I have a Coupon that has 3 specific Products required to be in the cart.
    In Coupon Data > Products > Matching Products – I have set it to a minimum of 2 products.
    In Cart, when adding the Coupon code, I get a message:
    “The minimum quantity of matching products for this coupon is 2.”

    Is there a way to change that message to show which products are required?

    Please advise



    You can achieve that by using the following snippet in functions.php:

    add_filter('woocommerce_coupon_error', 'my_custom_woocommerce_coupon_error_message', 999, 3 );
    function my_custom_woocommerce_coupon_error_message( $err, $err_code, $coupon ) {
      if ( $coupon->code == 'MY_COUPON_CODE' ) {
        $err = 'MY ERROR MESSAGE';
      return $err;

    Replace MY_COUPON_CODE with your coupon code and MY ERROR MESSAGE with the message you would like to show.


    Hi there

    Thank you so much for your reply.
    This works but I would need to manually add the name of the products. Is there a way for the message to dynamically show the name/url of the product that customer needs to add to cart?


    By further customizing the script this is possible.

    TIP: You can use $coupon->product_ids to get the product id(s) of the coupon. Then construct a WC_Product and you have all the info available you need; like $product->get_permalink() or $product->get_title() .

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