I want a WooCommerce hook that can help to add string Contact for shipping quotes
in front of Shipping Lable, by removing the shipping price on the checkout page. I'm developing a plugin and want to modify the shipping value.
I've tried many hooks. I tried to pass string to the following code, but it takes float/int value only.
WC()->cart->add_fee("Shipping", (float) $amount);
I have found a hook, that allows me to change/replace the Shipping value with string. I struggle for it many days:
This is the filter Hook:
add_filter( 'woocommerce_cart_totals_fee_html', 'custom_shipping_fee_html', 10, 2 );
And Function is:
function custom_shipping_fee_html( $fee_html, $fee ) {
// Check if the fee label is "Shipping"
if ( $fee->name === 'Shipping' ) {
$fee_html = esc_html__( 'Item unavailable for shipping, please contact us to get a shipping quote', 'woocommerce' );
}
return $fee_html;
}