wordpress - Show discount price on changing product quantity - Woocommerce Dynamic Pricing plugin -


i using woocommerce dynamic pricing plugin , facing issue show discounted price on product detail page.

i have 3 user roles , set pricing rules minimum , maximum product quantity on fixed price. when logged in specific role (stockist), it's not showing me discount price.

if add product cart shows me discounted price in cart.

is there way can change price on changing product quantity.

i have pricing rule as:

1) product quantity in between 4-16 price $40 2) product quantity in between 17-50 price $39 3) product quantity in between 51 , more price $35 

i found code not working dynamic pricing rules:

    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;display:none">%s %s</div>',__('product total:','woocommerce'),'<span class="price">'.$product->get_price().'</span>');     echo sprintf('<div id="cart_total_price" style="margin-bottom:20px;display:none">%s %s</div>',__('cart total:','woocommerce'),'<span class="price">'.$product->get_price().'</span>');     ?>         <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);                          $('#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 } 

can suggest me way that.

thanks


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -