8 Replies Latest reply on Aug 30, 2011 12:08 PM by AndyHopkins1965

# Order form - add shipping charge

Hi,

I am creating an order form.  Customers get free shipping if the order sub-total is over \$400.  I have the subtotal but not sure how to script the shipping box.

i.e.

If "subtotal" is < \$400, "8", if "Subtotal is > \$400, ""

Any help will be appreciated.

thanks

Andy

• ###### 1. Re: Order form - add shipping charge

Use this code as the custom calculation script:

event.value = "";

var subtotal = getField("subtotal").value;

if (Number(subtotal)<400) event.value = 8;

• ###### 2. Re: Order form - add shipping charge
function(){return A.apply(null,[this].concat(\$A(arguments)))}

AndyHopkins1965 wrote:

Hi,

I am creating an order form.  Customers get free shipping if the order sub-total is over \$400.  I have the subtotal but not sure how to script the shipping box.

i.e.

If "subtotal" is < \$400, "8", if "Subtotal is > \$400, ""

Any help will be appreciated.

thanks

Andy

What is to happen if the subtotal = 400? (From the first part of your message, one could assume that only totals over, but not equal to, \$400 get free shipping. But your pseudo code, and Try67's response, will get free shipping if the total is exactly 400)

• ###### 3. Re: Order form - add shipping charge

From the wording, it sounds as free shipping is when the value is greater than 400; so, the opposite is true if the value is smaller or equal than 400.

For the script it means that instead of "<", "<=" would be used.

Hope this can help.

Max Wyss.

• ###### 4. Re: Order form - add shipping charge

Thanks all, I appreciate your time.  I should have mentioned that it was \$400 or more (=>).  The script below has a syntax error.  All i did was add "=>"

does subtotal need quotes around each occurance?  It is the name of the field.

event.value = "";

var subtotal = getField("subtotal").value;

if (Number(subtotal)=>400) event.value = 8;

• ###### 5. Re: Order form - add shipping charge

It needs to be ">=", like so:

if (Number(subtotal)>=400) event.value = 8;

• ###### 6. Re: Order form - add shipping charge

It works!  thank you.

• ###### 7. Re: Order form - add shipping charge

Am I misreading something? It looks like you're now giving free shipping to orders under 400?

The original code Try sent does what you want if I understand what you are trying to do. Orders 400 and above will have free shipping; orders under 400 will be 8

• ###### 8. Re: Order form - add shipping charge

Thanks Mark.  It was a typo.  You have it right, and my form works great.

Thanks again for the assist!

Andy