Update shipping legacy flat rate label text when shipping cost “0”

Update shipping legacy flat rate label text when shipping cost ( Zero )”0″

function wc_update_flat_rate_label( $rates, $package ) {
if($rates[‘legacy_flat_rate’]->cost == 0){
$rates[‘legacy_flat_rate’]->label = “Free shipping”;
}
return $rates;
}
add_filter( ‘woocommerce_package_rates’, ‘wc_update_flat_rate_label’, 10, 2 );

Advertisements

PHP script for Fibonacci number

PHP script for first 20 Fibonacci numbers
<?php
$count = 0 ;
$c1 = 0;
$c2 = 1;
echo $c1.” , “;
echo $c2.” , “;
while ($count < 20 )
{
$c3 = $c2 + $c1 ;
echo $c3.” , “;
$c1 = $c2 ;
$c2 = $c3 ;
$count = $count + 1;
}
?>

<?php
/* Find number odd or even */
$num = 32;
$even = ($num % 2 == 0);
$odd = ($num % 2 != 0);
?>