woocommerce update price by quantity

This Snippets calculates the total price if you are using something like packaging units where multiple same items are within one purchasable product.

<div id="totals"> </div>
window.onkeyup = keyup;
var quantity;
var ep = 99
var vpe = 10
function keyup(e) {
  input = e.target.value;
  var price = quantity * ep;
  var pieces = quantity * vpe;
  console.log("Total Price: $" + price + ",00");
  console.log("Amount Items: " + pieces);
  document.getElementById("totals").innerHTML += "Items Total: " + pieces + “
 Price Total: $" + price + “

Place this snippet at your desired spot wihtin a html block (or widget), where the total pricing should be visible.


Please share your thumbsup, suggestions, edits, and questions within my comment section down there. 

I love posting snippets for you, but with a bit of feedback, it gets even more fun. 😀

Sharing is caring:

Share on xing
Share on linkedin
Share on whatsapp
Share on facebook
Share on twitter
Share on email

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.