Copy link to clipboard
Copied
Is there an existing script that will auto-calculate "B" and "C" when keying in a number value for "A", based on "D" OR "E"? (see attached) Any help would be greatly appreciated. Thanks in advance.
Multiply the result by the item price.
Copy link to clipboard
Copied
Is there an existing script that will auto-calculate "B" and "C" when keying in a number value for "A", based on "D" OR "E"? (see attached) Any help would be greatly appreciated. Thanks in advance.
Multiply the result by the item price.
Copy link to clipboard
Copied
A script could certainly be written. You won't find that scripts just exist already, there are countless trillions of possible needs. Many of us see our task here as helping to learn to write your own scripts. Do you have any coding experience already?
Copy link to clipboard
Copied
This is certainly possible, but you need to better explain how it should work.
Is the number in A free for you the user to enter? What should happen if they enter 54, for example?
Copy link to clipboard
Copied
Thanks for the response try67. If it’s possible to populate the FREE field that would be great, but I don’t believe it’s necessary. My understanding for the BUY 11, Get 1 Free and BUY 100, GET 20 Free is that partial orders do not receive FREE QTY. If they enter 54 for the Buy 11 Get 1 FREE it would be 4 Free since they would have to purchase 55 to obtain 5 FREE. The Net GSP price/unit remains the same.
11-21, get 1 free
22-32, get 2 free
33-43, get 3 free … and so on.
Copy link to clipboard
Copied
You can use this code as the custom calculation script of the "Free Qty" field:
var totalItems = Number(this.getField("Qty").valueAsString);
var freeItems = Math.floor(totalItems/100);
totalItems -= freeItems*100;
freeItems += Math.floor(totalItems/11);
event.value = freeItems;
Copy link to clipboard
Copied
That's awesome, thank you. But how do i get the subtotal to calculate based on the quantity selected with the 3 different price points?
Copy link to clipboard
Copied
Multiply the result by the item price.
Copy link to clipboard
Copied
Thank you so much. This worked out great. Much appreciated.