JavaScript on cart for Shipping

General ShopSite user discussion

JavaScript on cart for Shipping

Postby JCGrafted » Wed Nov 09, 2011 9:27 am

I recently found out that you can run JavaScript on the shopping cart. (See post "Limit one per order")

I would like to use a similar solution on a different problem.

We use three methods of shipping, all through the US Post Office. They are:

International - all except USA orders MUST use this option
Media mail - cheaper, but slower, and you can't choose this option if ordering some products
1st class - for all other orders

We often have International orders choosing Media mail or 1st class, or orders for Media mail that contain products banned by the Post Office for Media mail. As it is, our store does not catch the errors and we must call the customer.

In the code for Limit one per order (see ShopSite tutorial on limiting a product to a maximum quantity: http://support.lexiconn.com/news/viewtopic.php?t=415), gives the ShopSite code for accessing the SKU number for items in the shopping cart (ss_sku).

What I am hoping for is the code to access and change the shipping options. I would also like to access the postal code the user is entering.
JCGrafted
 
Posts: 29
Joined: Wed Sep 21, 2011 2:41 pm
Location: Houston, TX

Re: JavaScript on cart for Shipping

Postby Jim » Wed Nov 09, 2011 10:04 am

http://www.shopsite.com/help/11.1/en-US/sc/pro/cart.variables.html gives a list of the available javascript variables (Pro stores) . You can also view the javascript that ShopSite uses to check the zip field value if you put an item in the cart and then view the page source.

I don't think you can (or should) change the shipping option programatically but you could pop up a message saying the only valid shipping option for the selected country is x, Then you can prevent them from checking out until they choose that shipping option.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: JavaScript on cart for Shipping

Postby robm » Wed Nov 09, 2011 10:09 am

We have a tutorial for using JavaScript to restrict shipping options that are chosen:

http://support.lexiconn.com/news/viewtopic.php?t=289

It doesn't hide the options, but can be used to stop international customers from choosing US based options.

Rob
LexiConn - ShopSite Hosting
robm
 
Posts: 463
Joined: Fri Aug 04, 2006 5:46 pm
Location: Connecticut

Re: JavaScript on cart for Shipping

Postby JCGrafted » Wed Nov 09, 2011 10:27 am

Jim, you are a gem. Thanks
JCGrafted
 
Posts: 29
Joined: Wed Sep 21, 2011 2:41 pm
Location: Houston, TX

Re: JavaScript on cart for Shipping

Postby JCGrafted » Wed Nov 09, 2011 10:43 am

Rob, Thank you.
JCGrafted
 
Posts: 29
Joined: Wed Sep 21, 2011 2:41 pm
Location: Houston, TX


Return to User Forum

Who is online

Users browsing this forum: No registered users and 97 guests

cron