Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #640636

    Hi,

    I’d like to change the word ‘free!’ on my enfold theme to ‘price on request’ when the price in woocommerce is 0 or blank I’ve been looking i found this below but every time i added to my child php it stopped the whole website from loading with an error message

    add_filter( ‘woocommerce_variable_free_price_html’, ‘hide_free_price’ );
    add_filter( ‘woocommerce_free_price_html’, ‘hide_free_price’ );
    add_filter( ‘woocommerce_variation_free_price_html’, ‘hide_free_price’ );
    function hide_free_price($price){
    return ‘Price on Request’;
    }

    Any help would be appreciated

    Thanks

    Alex

    #640704

    Hi Alex,

    This is likely not theme specific so I would recommend you ask the question on a WooCommerce forum as well. Where did you find the code you added? Please send us a temporary admin login so that we can have a closer look. You can post the details in the Private Content section of your reply.

    Thanks,
    Rikard

    #640774

    Hi
    I found the code on a wordpress blog a number of others said that i had worked for them.

    I will put this in the woo commerce forum too

    Thanks in advance

    Alex

    #641270

    Hi,

    Please add this in the functions.php file:

    
     function avf_woocommerce_free_price_html( $price, $instance ) {
         $price = '<span class="amount">TEXT HERE!</span>';
         return $price;
     };
    
     add_filter( 'woocommerce_free_price_html', 'avf_woocommerce_free_price_html', 10, 2 );
    

    Adjust the text.

    Best regards,
    Ismael

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.