update price variable products
-
Hi,
i have this code but it only works with Simple Products, is there a way to easily change it so works with: VAriable Products as well please?
// we are going to hook this on priority 31, so that it would display below add to cart button. add_action( 'woocommerce_single_product_summary', 'woocommerce_total_product_price', 31 ); function woocommerce_total_product_price() { global $woocommerce, $product; ?> <script> jQuery(function($){ var price = <?php echo $product->get_price(); ?>, current_cart_total = <?php echo $woocommerce->cart->cart_contents_total; ?>, currency = '<?php echo get_woocommerce_currency_symbol(); ?>'; $('[name=quantity]').change(function(){ if (!(this.value < 1)) { var product_total = parseFloat(price * this.value), cart_total = parseFloat(product_total + current_cart_total); $('.amount').html( currency + product_total.toFixed(2)); } $('.amount').toggle(!(this.value <= 1)); }); }); </script> <?php }Thanks
AaronThe page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘update price variable products’ is closed to new replies.