woocommerce_coupon_error

woocommerce_coupon_error

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.8.7.0

apply_filters('woocommerce_coupon_error') is found 3 times:

  • /includes/class-wc-coupon.php line 1083
    			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 1107
    				$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 1013
    			 * @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 );
    
    			return new WP_Error(
    				'invalid_coupon',
    				$message,
    				array(
    					'status' => 400,