WordPress.org

Support

Support » Plugins and Hacks » Woocommerce : change Out of Stock text

Woocommerce : change Out of Stock text

  • Jud Haynes

    @jud-haynes

    I’m loving Woocommerce these days. Most items I’ve wanted to update have been easy to find but I’ve hit a couple snags. Looking at you MikeJolley, thinking you can help here.

    1. I’d like to change the words “Out of Stock” to “Currently Unavailable” on a product page when it is set to “Out of Stock” in the admin tool. I thought it would be a simple change but have hit every wall trying to figure it out.

    Thanks so much for the help!

Viewing 10 replies - 1 through 10 (of 10 total)
  • We’re looking at doing the same – we don’t intend to stock every product that we supply, but we still want to display full product info including prices.

    We can use the out of stock functionality to prevent people from being able to order the parts online while still seeing the price, but rather than the site displaying ‘out of stock’, we would like it to say ‘call for availability info’. And we don’t like the purple text, so we’d want to change that.

    Can anyone help?

    @jud Haynes, you can try below code:

    add_filter( ‘woocommerce_get_availability’, ‘custom_get_availability’, 1, 2);

    // Our hooked in function $availablity is passed via the filter!
    function custom_get_availability( $availability, $_product ) {
    if ( !$_product->is_in_stock() ) $availability[‘availability’] = __(‘Currently Unavailable’, ‘woocommerce’);
    return $availability;
    }

    @serioussam, you can try below code:

    add_filter( ‘woocommerce_get_availability’, ‘custom_get_availability’, 1, 2);

    // Our hooked in function $availablity is passed via the filter!
    function custom_get_availability( $availability, $_product ) {
    if ( !$_product->is_in_stock() ) $availability[‘availability’] = __(‘call for availability info’, ‘woocommerce’);
    return $availability;
    }

    If nobody has told you…. Thank you Terry. 🙂

    Hi rawlsenterprises, thank you, i feel great as can help you all 🙂 cheers!

    thanks too!

    Hi terrytsang
    Perfect, I was searching for this fix also!
    Another BIG thank you from me 🙂

    suefenton

    @suefenton

    @terrytsang, this is exactly what I’m looking for, thank you, but I’m new to web building and am teaching myself. Where do you insert this code?

    terrytsang

    @terrytsang

    Thanks all 🙂

    @suefenton, you need to put the code to your functions.php file inside your theme folder.

    more details can refer my tutorial

    4jDesigns

    @4jdesigns

    Thanks Terry! Saved me a whole lot of messing around.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Woocommerce : change Out of Stock text’ is closed to new replies.
Skip to toolbar