I am trying to use the Progress Bar plugin in wordpress to create a widget that shows a progress bar under the shopping cart of how much more they need to spend in order to get free shipping.
I need to first take the value of the cart:
global $woocommerce;
$price = $woocommerce->cart->get_cart_total();
Secondly Strip the dollar sign and round to nearest integer ?
Thirdly Output the value into the shortcode, so it displays properly into the HTML. As it is now, it outputs this for the width instead of a number.<span class="red" style="width: .$cartnumber%;">
I need this to output a plain number so it will work with the width. Below is the code so far.
<?php
global $woocommerce;
$total = $woocommerce->cart->get_cart_total();
$cartnumber = str_replace("$", "", $total);
echo do_shortcode('[wppb progress='.$cartnumber.' option=red text="Free Shipping"]');
?>
I have enabled PHP execution within widgets for