How can the stock status text be changed?

add_filter( 'woocommerce_get_availability', 'custom_stock_text', 1, 2);

function custom_stock_text( $availability, $_product ) {
    
    // Change the in stock text
    if ( $_product->is_in_stock() ) {
        $availability['availability'] = __('Vorrätig, lieferbar in 2 – 4 Arbeitstagen', 'woocommerce');
    }
	
	  // Change the delivery backlog text
    if ( $_product->is_on_backorder() ) {
        $availability['availability'] = __('Vorbestellung, Lieferbar in 1 – 2 Wochen', 'woocommerce');
    }
	
	// Change the out of stock text
    if ( ! $_product->is_in_stock() ) {
        $availability['availability'] = __('Zurzeit leider nicht lieferbar', 'woocommerce');
    }

    return $availability;
}
Without cookies
This website does not use cookies or tracking. More information can be found in the privacy policy.