Hi @basvweb,
This will require some custom coding.
I’ve adapted the following code from this Stack Overflow thread – https://stackoverflow.com/a/35691378/6438880
add_action( 'woocommerce_single_product_summary', 'woocommerce_total_product_price', 31 );
function woocommerce_total_product_price() {
global $woocommerce, $product;
// let's setup our divs
echo sprintf('<div id="product_total_price" style="margin-bottom:20px;">%s %s</div>',__('Product Total:','woocommerce'),'<span class="price">'.wc_get_price_to_display($product).'</span>');
?>
<script>
jQuery(function($){
var price = <?php echo wc_get_price_to_display($product); ?>,
currency = '<?php echo get_woocommerce_currency_symbol(); ?>';
$('[name=quantity]').change(function(){
if (!(this.value < 1)) {
var product_total = parseFloat(price * this.value);
$('#product_total_price .price').html( currency + product_total.toFixed(2));
}
});
});
</script>
<?php
}
* I recommend using Code Snippets to add custom code to your site.
Hope this helps.
Thanks.
@abwaita Thank you so much! This is great!
One last question, I get it if it’s to hard to implement but on this website I work with selling products from 0,5 and with steps of 0,1.
Now the code works perfect once it gets above 1,0 but doesn’t do anything between 0,5 and 0,9 quantity. Is there a way to fix this?
Here is the example: http://136.144.210.243/~modestofwp/product/swafing-miraculous-lady-bug/
Hi @basvweb,
Glad to hear that @abwaita’s code snippet worked for you!
Now the code works perfect once it gets above 1,0 but doesn’t do anything between 0,5 and 0,9 quantity. Is there a way to fix this?
For this type of questions, you’re more likely to get input by asking in the WooCommerce Developer Slack or Advanced WooCommerce Facebook group. As those communities are both frequented by developers.
If you do require assistance with custom development tasks you could also reach out to some of the official WooCommerce development partners via: https://woocommerce.com/customizations/
Thanks.
Hi there,
It’s been a while since we last heard back from you. I’m going to mark this thread as resolved.
Hopefully, the above information was helpful. If you have further questions, please feel free to open a new topic.
Cheers.