I have multiple shipping options on my page and wanted to put the label “free” next to them when the customer buys goods for more then 2500 czech crowns.
I’m using Set all shipping methods costs to zero based on cart items subtotal in WooCommerce answer code which makes the shipping methods free, but it doesn’t put the label next to them, that actually says “free”.
I wanted to put my text next to the shipping methods – eg. “Fedex (Free)”.
I tried to implement this code:
$rates[$rate_key]->label = __("Here your text", "woocommerce");
but it only changes the label of the shipping method, it doesn’t put the label next to it.
Thanks
Advertisement
Answer
Don’t use =
but .=
(concatenating assignment operator)
So just replace
$rates[$rate_key]->label = __("Here your text", "woocommerce");
With
$rates[$rate_key]->label .= __( 'Here your text', 'woocommerce' );