type:
snippet
category:
shipping
name:
Setting a single flat rate shipping amount no matter which categories are included
versions:
0.6.0, 0.7.0, 0.7.1, 0.7.2, 1.0, 1.1
reference:
http://forum.foxycart.com/comments.php?DiscussionID=4389&page=1
tags:
snippets, shipping, advance
date:
2011-05-27

Setting a single flat rate shipping amount no matter which categories are included

Versions 0.7.1 and older: Note that applying javascript shipping modifications using either live or flat rates where you are setting custom values has been found to not work as expected for subscription based products where you need the shipping to apply to each subscription renewal. A fix is in place for versions 0.7.2 and newer.

Using version 2.0? There is a new snippet available for our latest version, available from here.

If you're using handling fees note that you can't overwrite handling fees using javascript on the checkout to provide free shipping. While it will appear that the shipping is $0 on the checkout, the handling fees will be added back in server-side, and the customer will see a shipping fee that matches the handling fee cost you have set in the administration.

When using multiple categories but you want a single flat rate shipping value for the whole shipment (rather than per category), you need to set this up using javascript. Currently, if all of your categories had a flat rate shipping value of 9, having a product from two different categories would equal $18 shipping rather than a flat $9.

Step 1: Update categories

Update all categories to 'Shipped using a flat rate fee' with a value of 0 in the 'Product Delivery Option' section.

Step 2: Insert Javascript

Paste the following right before the closing </head> tag in your checkout template, and update the value to be whatever shipping cost you need:

<script type="text/javascript" charset="utf-8">
jQuery(document).ready(function() {
  FC.checkout.config.orderFlatRateShipping = 9;
  FC.checkout.updateShipping(-1);
});
</script>

This will make the shipping charges $9 no matter what is added to the cart.

Site Tools