woocommerce_coupon_error

woocommerce_coupon_error

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: woocommerce.9.5.1

apply_filters('woocommerce_coupon_error') is found 3 times:

  • /includes/class-wc-coupon.php line 1120
    			default:
    				$err = '';
    				break;
    		}
    		return apply_filters( 'woocommerce_coupon_error', $err, $err_code, $this );
    	}
    
    	/**
    	 * Map one of the WC_Coupon error codes to an error string.
    	 * No coupon instance will be available where a coupon does not exist,
    	 * so this static method exists.
    
  • /includes/class-wc-coupon.php line 1144
    				$err = '';
    				break;
    		}
    		// When using this static method, there is no $this to pass to filter.
    		return apply_filters( 'woocommerce_coupon_error', $err, $err_code, null );
    	}
    
    	/**
    	 * Get the coupon information that is needed to reapply the coupon to an existing order.
    	 * This information is intended to be stored as a meta value in the order line item corresponding to the coupon
    	 * and should NOT be modified or extended (additional/custom data should go in a separate metadata entry).
    
  • /includes/class-wc-discounts.php line 1073
    			 * @param string    $error_message Error message.
    			 * @param int       $error_code    Error code.
    			 * @param WC_Coupon $coupon        Coupon data.
    			 */
    			$message = apply_filters( 'woocommerce_coupon_error', is_numeric( $e->getMessage() ) ? $coupon->get_coupon_error( $e->getMessage() ) : $e->getMessage(), $e->getCode(), $coupon );
    
    			$additional_data = array(
    				'status' => 400,
    			);
    
    			$context_coupon_errors = $coupon->get_context_based_coupon_errors( $e->getCode() );
    

See this hook used in plugins: