Support » Plugin: WooCommerce » out of stock and sales labels

  • After updating woocommerce all the products went on sale. Now I know that this happened because of some of the products not having any pricing. The ones that have pricing, I was able to re-save the posts and it would fix it. But we have items that don’t have a pricing that we would like to show a call for info.

    I was thinking that changing the out-of-stock label to call-for-info would be the way to go but I can’t get it to work.
    I found some codes from the past that should do that but they don’t seem to work.
    I added this to my functions file in my parent theme. If I add it to my child theme, it breaks the page.
    Can somebody let me know, how to do that, please?

    add_filter( ‘woocommerce_get_availability’, ‘custom_get_availability’, 1, 2);
    function custom_get_availability( $availability, $_product ) {
    global $product;
    $stock = $product->get_total_stock();
    if ( $_product->is_in_stock() ) $availability[‘availability’] = __($stock . ‘ AVAILABLE’, ‘woocommerce’);
    if ( !$_product->is_in_stock() ) $availability[‘availability’] = __(‘CALL FOR INFO’, ‘woocommerce’);
    return $availability;

  • The topic ‘out of stock and sales labels’ is closed to new replies.