Change the free shipping label into applied free shipping rule title
Update the free shipping label to reflect the applied free shipping rule title.
add_filter( 'woocommerce_cart_shipping_method_full_label', function( $label, $method ) {
if(is_object($method) && $method->method_id == 'wdr_free_shipping' && class_exists('\Wdr\App\Controllers\ManageDiscount') && class_exists('\Wdr\App\Controllers\DiscountCalculator')) {
if (!empty(\Wdr\App\Controllers\ManageDiscount::$calculator)) {
$calc = \Wdr\App\Controllers\ManageDiscount::$calculator;
$applied_rules = $calc::$applied_rules;
foreach ($applied_rules as $applied_rule) {
if($applied_rule->rule->discount_type == 'wdr_free_shipping') {
$label = $applied_rule->rule->title;
}
}
}
}
return $label;
}, 10, 2);