mercredi 6 avril 2016

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 this in my functions.php and it works, showing the contact form 7 submit button in place of "Free!" but i cant seem to get the if statement correct for disabling the button for a non logged in user. is there somthing i 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';        
}

Aucun commentaire:

Enregistrer un commentaire