Woocommerce Product Price change(free) based on warranty status <p>I want to set few woocommerce product price free based on warranty status.</p> <p>Products are: <code>$target_products = array('2917','1229','1277');</code></p> <p>for Example : <code>$warranty_status = 1</code> mean, valid for warranty .</p> <p>if a customer has a valid warranty status the price of selective product will be free. So I try bellow code and I'm sucked at how to get all <code>$target_products</code> price &amp; set their new value . I'm not sure which hook will work fine.</p> <pre><code>function warranty_free_price( $price, $product ) { global $current_user,$wpdb; $target_products = array('2917','1229','1277'); get_currentuserinfo(); $loggedin_user_id = $current_user-&gt;user_login ; //check for warranty status $warranty_status = $wpdb-&gt;get_var("SELECT warranty_stat FROM {$wpdb-&gt;prefix}wc_product_license_reg WHERE customer = '$loggedin_user_id'"); if(!$warranty_status == 1){ return; // 1 = valid for warranty }else{ if ( in_array ($product-&gt;product_id ,$target_products ) ) { foreach (----------){//help me to figure this out $price = $product-&gt;get_price(); }//end for each } // return warranty price return $price; } } add_filter('woocommerce_get_price_html', 'warranty_free_price', 10, 2); </code></pre> <p>Please help...</p>