Add text before Weight WooCommerce

Viewed 88

I am using Woo Variations Table plugin a would like to add text before atribute weight. Is there a way to do it? I was able to add label text before price but no luck with weight.

// code
add_filter( 'woocommerce_get_price_html', 'cw_change_product_price_display' );
add_filter( 'woocommerce_cart_item_price', 'cw_change_product_price_display' );
function cw_change_product_price_display( $price ) {
    
    $text = __('TEXT');

    // returning the text before the price
    return $text . ' ' . $price;
}
1 Answers
add_filter( 'woocommerce_format_weight', 'woocommerce_format_weight', 10, 2 );

function woocommerce_format_weight( $weight_string, $weight ) {
    return __( "Weight Text", "woocommerce" ) . $weight_string;
}
Related