The idea is simple. On the WooCommerce product page, as the customer changes quantity, display the product total (increase or decrease in price) price and the cart subtotal.
I'm stuck right now. I get no errors even with debug turned on. Nothing shows on the product page.
add_action( 'woocommerce_after_add_to_cart_form', 'total_product_and_subotal_price' );
function total_product_and_subotal_price() {
global $product;
// the div section
echo sprintf('',__('Product Total:','woocommerce'),''.$product->get_price().'');
echo sprintf('',__('Cart Total:','woocommerce'),''.$product->get_price().'');
?>
<script>
jQuery(function($){
var price = get_price(); ?>,
current_cart_total = cart->cart_contents_total; ?>,
currency = '';
$('[name=quantity]').change(function(){
if (!(this.value < 1)) {
var product_total = parseFloat(price * this.value),
cart_total = parseFloat(product_total + current_cart_total);
$('#product_total_price .price').html( currency + product_total.toFixed(2));
$('#cart_total_price .price').html( currency + cart_total.toFixed(2));
}
$('#product_total_price,#cart_total_price').toggle(!(this.value <= 1));
});
});
</script>
<?php
}