• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to custom calculate for a form field based on the total in another field. Tiered calculations

Community Beginner ,
Jul 12, 2021 Jul 12, 2021

Copy link to clipboard

Copied

Hi There! Super new to all of this so bare with me. There are 2 form fields that I am trying get to automatically calculate the tiered discount and tiered shipping... according to what the Subtotal is.

The TOTALDiscount Field and the TOTALSHIPPING field.

 

TOTALDiscount- I need to automatically calculate the discount received according to the SUBTOTAL and the following tier:
5% discount off of Subtotal for Subtotal that is $3500-$6999

10% discount off of Subtotal for Subtotal that is $7000 or more.

 

TOTALSHIPPING - I need to automatically calculate the shipping cost according to the SUBTOTAL and the following tier:

15% calculation of Subtotal if Subtotal is $1-$500

10% calculation of Subtotal if Subtotal is $501-$1000

7% calculation of Subtotal if Subtotal is $1001-$5000

4% calculation of Subtotal if Subtotal is $5001 or more

 

I hope this makes sense! Thank you for your help!

Beemonkie_0-1626139311735.png

 

TOPICS
JavaScript

Views

802

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Jul 12, 2021 Jul 12, 2021

Copy link to clipboard

Copied

Put script as "Custom calculation script" in:

TOTALDiscount:

var sub = this.getField("SUBTOTAL").value;
if(sub >= 3500 && sub <= 6999) event.value = sub*.05;
else if(sub >= 7000) event.value = sub*.10;
else event.value = "";

 

TOTALSHIPPING:

var sub = this.getField("SUBTOTAL").value;
if(sub >=1 && sub <=500) event.value = sub*.15;
else if(sub >=501 && sub <=1000) event.value = sub*.10;
else if(sub >=1001 && sub <=5000) event.value = sub*.07;
else if(sub >=5001) event.value = sub*.04;
else event.value = "";

View solution in original post

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 12, 2021 Jul 12, 2021

Copy link to clipboard

Copied

OH! I am using Adobe Acrobat Pro DC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 12, 2021 Jul 12, 2021

Copy link to clipboard

Copied

Use Javascript at Custom Calculation Script.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 12, 2021 Jul 12, 2021

Copy link to clipboard

Copied

Put script as "Custom calculation script" in:

TOTALDiscount:

var sub = this.getField("SUBTOTAL").value;
if(sub >= 3500 && sub <= 6999) event.value = sub*.05;
else if(sub >= 7000) event.value = sub*.10;
else event.value = "";

 

TOTALSHIPPING:

var sub = this.getField("SUBTOTAL").value;
if(sub >=1 && sub <=500) event.value = sub*.15;
else if(sub >=501 && sub <=1000) event.value = sub*.10;
else if(sub >=1001 && sub <=5000) event.value = sub*.07;
else if(sub >=5001) event.value = sub*.04;
else event.value = "";

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 12, 2021 Jul 12, 2021

Copy link to clipboard

Copied

LATEST

THANK YOU SOOOOO MUCH!! It works perfectly!!

Thank you!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines