woocommerce_coupon_is_valid_for_product

woocommerce_coupon_is_valid_for_product

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_is_valid_for_product') is found 2 times:

  • /includes/class-wc-coupon.php line 926
    	 * @return bool
    	 */
    	public function is_valid_for_product( $product, $values = array() ) {
    		if ( ! $this->is_type( wc_get_product_coupon_types() ) || ! is_a( $product, WC_Product::class ) ) {
    			return apply_filters( 'woocommerce_coupon_is_valid_for_product', false, $product, $this, $values );
    		}
    
    		$valid        = false;
    		$product_cats = wc_get_product_cat_ids( $product->is_type( 'variation' ) ? $product->get_parent_id() : $product->get_id() );
    		$product_ids  = array( $product->get_id(), $product->get_parent_id() );
    
    
  • /includes/class-wc-coupon.php line 963
    		if ( $this->get_exclude_sale_items() && $product->is_on_sale() ) {
    			$valid = false;
    		}
    
    		return apply_filters( 'woocommerce_coupon_is_valid_for_product', $valid, $product, $this, $values );
    	}
    
    	/**
    	 * Converts one of the WC_Coupon message/error codes to a message string and.
    	 * displays the message/error.
    	 *
    

See this hook used in plugins: