Change product availability In stock text by a custom text in WooCommerce

Change product availability In stock text by a custom text in WooCommerce on your child site.

Snippet Type

Execute on Child Sites

Snippet

add_filter( 'woocommerce_get_availability_text', 'filter_product_availability_text', 10, 2 );
function filter_product_availability_text( $availability_text, $product ) {
    
    return str_replace( 'in stock', __('remaining copies', 'woocommerce'), $availability_text );
}
1 Like