• I’m trying to change the ‘out of stock’ ribbon on product thumbnails and within the product page to say ‘sold’. I’ve tried adding below codes to functions.php but neither worked. Any help with this really appreciated. (note I have twi product carousel installed and i wonder if this is affecting it at all).

    Thanks

    code 1:
    add_filter( ‘woocommerce_get_availability’, ‘wcs_custom_get_availability’, 1, 2);
    function wcs_custom_get_availability( $availability, $_product ) {

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

    Code 2
    function availability_filter($availability) {
    $availability[‘availability’] = str_ireplace(‘Out of stock’, ‘SOLD’, $availability[‘availability’]);
    return $availability;
    }
    add_filter(‘woocommerce_get_availability’, ‘availability_filter’);

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello,

    Try the plugin “Say What”, which lets you change the text shown.
    https://wordpress.org/plugins/say-what/

    Thread Starter chrisharvey1979

    (@chrisharvey1979)

    Just wanted to follow up my solution for this in case it’s useful for anyone. So i accessed the twi carousel plugin files via my ftp client. I searched the files for text string “out of stock” and found the location of these within the files. I changed this to ‘Sold’. Specifically the changing this within the file rib.php solved the problem. It’s likely that if i need to update the plugin in the future i will need to change this text again but it’s worked for now.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘change ‘out of stock’ text’ is closed to new replies.