I have problem with making progress bar for free shiping in woocommerce.

I manage to get cart total ,take it to $cartnumber ,but when i want to do “if else” to see is user have enough in cart im still getting zero.

<?php                     
  global $woocommerce;
  $total = $woocommerce->cart->get_cart_total();            
  $cartnumber = $total;         
  $cartnumber = substr($cartnumber, 0, strpos($cartnumber,'.'));
  $flota = (int)$cartnumber;
  if ($flota >= 1000) {
    $prog = 100;
    echo do_shortcode('[wppb progress='.$prog.'/100 option=red text="Darmowa dostawa !"]');
    }
    else
    {
    $brak = 1000 - $flota ;
    $prog = $flota / 10 ;
    echo do_shortcode('[wppb progress='.$prog.'/100 option=red text="Brakuje '.$brak.'zł do darmowej dostawy."]');
    }
  printf('<h2>%1$s</h2>',                        __('W koszyku masz towar za '.$flota.' !')
  )
  ?>

var $flota is still 0 .

Anyone can help me with this?

Read more here: If statment and progress bar - woocommerce get_cart_total()


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , ,

Wordpress related questions and answers: