Set Shipping Cost Based on Order Total in Adobe Acrobat PDF Forms
Question details
Set a PDF form's shipping cost automatically based on its order total.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- An order form should charge $12.99 shipping for totals below $300 and $0 for totals of $300 or more.
- Observed behavior
- The shipping field should update when the order total changes, while remaining $0 if the total is blank.
Open the form in Adobe Acrobat and check the exact name of the order total field in Prepare a Form. Make sure its value is a plain number that JavaScript can convert, without currency symbols or thousands separators.
Add a Custom Calculation Script to the Shipping Field
Use this method to calculate shipping automatically from the order total in an Acrobat PDF form.
Open the PDF in Adobe Acrobat, then select All tools > Prepare a form.
Double-click the shipping cost field, or right-click it and select Properties. Open the Calculate tab.
Select Custom calculation script, click Edit, and enter: var total = Number(this.getField("product total").valueAsString); if (this.getField("product total").valueAsString != "" && total < 300) event.value = 12.99; else event.value = 0; Replace "product total" with the exact name of your order total field if it differs.
Click OK, close the field properties, and save the PDF. Enter totals such as 299.99 and 300 to verify that shipping changes to $12.99 and $0, respectively.

Work With PDF Order Forms and Office Files in WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface for working with PDFs and common Office files. Its format compatibility makes it easy to move everyday documents and spreadsheets between suites. Use Adobe Acrobat to add and test the custom PDF form calculation described above.

Frequently Asked Questions
What happens when the order total is exactly $300?
The script sets shipping to $0 because the $12.99 charge applies only when the total is less than 300.
Where do I find the order total field's name?
In Acrobat, open All tools > Prepare a form and double-click the order total field. Check its name in the field properties, then use that exact name in both getField references.
Why does the shipping field stay at $0 when the total is blank?
The script checks for an empty order total and sets shipping to $0 until a value is entered.
Why might the calculation not work in another PDF viewer?
The viewer must support Acrobat form calculations and JavaScript. Test the saved form in Acrobat or another compatible PDF viewer, and check that JavaScript is enabled.
Can the script read a total with a currency symbol or comma?
The Number conversion in this script expects a plain numeric value. Check the total field's value and formatting if it includes a currency symbol or thousands separator.




