php - How to change the FREE label to Price on Request and include a button to request a price if the user is logged in -
i have put in functions.php , works, showing contact form 7 submit button in place of "free!" cant seem if statement correct disabling button non logged in user. there somthing have missed?
//remove free when 0 add_filter( 'woocommerce_variable_free_price_html','remove_free_price_text' ); add_filter( 'woocommerce_free_price_html','remove_free_price_text' ); add_filter( 'woocommerce_variation_free_price_html','remove_free_price_text' ); function remove_free_price_text( $price ) { if ( is_user_logged_in() ) echo do_shortcode( '[contact-form-7 id="3696" title="request price"]' ); elseif ( !is_user_logged_in() ) return 'price upon request'; }
try
if ( is_user_logged_in() ){ echo do_shortcode( '[contact-form-7 id="3696" title="request price"]' ); }else{ echo('price upon request'); }
Comments
Post a Comment