[Support request] Out of Stock text

Home Forums Support Out of Stock text

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1301149
    Ivan

    Hi all

    I would like to change the text “Read More” for non stock products, I’ve found a tons of codes but none works with GeneratePress, could you help me? It has to be something easy 🙁

    #1301313
    Leo
    Staff
    Customer Support

    Hi there,

    I’m not sure if there is a way to change the button text but what about a solution like this?
    https://generatepress.com/forums/topic/mostrar-etiqueta-agotado/#post-1280422

    #1301563
    Ivan

    Hi Leo

    This will hide the product and its not what I need as I have the option to receive an email when the product is again avaiable.

    I had it working with a Plugin, but was too heavy just for this funcionality so this is why I would like a snippet, this is the one I found but not working if I put it on theme/functions.php 🙁

    add_filter(‘woocommerce_get_availability’, ‘availability_filter_func’);

    function availability_filter_func($availability)
    {
    $availability[‘availability’] = str_ireplace(‘Out of stock’, ‘Sold’, $availability[‘availability’]);
    return $availability;
    }

    Br
    Ivan

    #1301583
    Ash

    This should change ‘Out of Stock’ text if that’s what you need

    add_filter( ‘woocommerce_get_availability’, ‘db_custom_get_availability’, 1, 2);
    function db_custom_get_availability( $availability, $_product ) {

    // Change Out of Stock Text
    if ( ! $_product->is_in_stock() ) {
    $availability[‘availability’] = __(‘Sold Out’, ‘woocommerce’);
    }
    return $availability;
    }

    #1301765
    Ivan

    Nothing 🙁 , maybe it’s due the translation that overlap the function? No clue…

    #1301919
    David
    Staff
    Customer Support
    #1301952
    Ivan

    That´s worked David, thanks!

    Br
    Ivan

    #1301959
    David
    Staff
    Customer Support
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.