About foxycart_includes.js

The foxycart_includes.js file is specific to your store version (as specified in your store settings). Depending on your FoxyCart store version it will include minified or packed javascript, along with comments in the file to indicate where the non-compressed version are, should you need to view them.

  • jquery.js: We're currently using jQuery. See below for a note about jQuery's noConflict mode.
  • foxycart.js: This file contains the code necessary to use the JSON object, as well as some other code specific to FoxyCart.
  • foxybox.js: “FoxyBox” is simply a modified version of Cody Lindley's very cool Thickbox. FoxyCart is currently using version 2 of Thickbox.
    • To change the size of your thickbox go foxybox.
  • v032 and previous: form.js: We're using malsup.com's form.js to assist with sending form data to your cart.

Included Functions


If it exists, the function fc_PreProcess() is called before the standard Thickbox-based cart is opened, before an “add to cart” request is processed. If fc_PreProcess() returns true, the cart add will proceed. If false is returned, the cart add will be aborted. This is useful for validating input prior to accepting it in the cart.

As of 0.4.0 fc_PreProcess() is passed two variables:

  1. The data passed in from the link or form, serialized (ie. name=testing%2001&code=001a&price=10&color=red{p+4})
  2. The ID of the link or form that passed in the data, if an ID exists.


fc_BuildFoxyCart() is run when the standard Thickbox-based cart is closed. This is useful for resetting form values, manipulating the JSON, or etc.

Examining ''foxycart_includes.js''

If you'd like to see exactly what's included in foxycart_includes.js you can view the source of the file for your store. In the comments are paths to the full, uncompressed versions of the files.

Serving ''foxycart_includes.js'' from your server

You are free to save foxycart_includes.js locally on your own server and serve it to your users from there. It will work just fine, and may offer advantages in certain situations. There are a few things to realize though, and please note that we cannot promise that this will continue to work so testing is always required.

  • You need to pull only your store's foxycart_includes.js file, from your domain, like http://yourdomain.foxycart.com/path/to/foxycart_includes.js. You cannot use another store's includes file, since the FoxyDomain variable will not match up and you'll have session issues.
  • If you upgrade your FoxyCart store version you'll have to remember to re-save the latest version of foxycart_includes.js, or things might not function as expected.
  • Do not include the _includes file in your cart or checkout templates. This will cause problems.

About jQuery in ''foxycart_includes.js''

jQuery Versions

The version of jQuery included in foxycart_includes.js is dependent on the version of FoxyCart you're using. You can view the source and check the comment to see the full path to an uncompressed version, and in that source you can find the jQuery version.

noConflict Mode

In versions prior to v051 jQuery was called by default in noConflict() mode like this:

var $j = jQuery.noConflict();

This removed the default jQuery $ shortcut and replaced it with $j. For these older versions of FoxyCart you can set the default shortcut back to $ by following the instructions below.

Setting jQuery to ''noConflict'' mode

In FoxyCart v051+ jQuery is not called in noConflict mode in foxycart_includes.js. If you need jQuery called in noConflict() mode you can simply include the noConflict() call right after you call foxycart_includes.js, like this:

<script src="https://example.foxycart.com/files/foxycart_includes.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">

Similarly, if you'd like to map the $j shortcut back to jQuery to maintain compatibility with previous FoxyCart versions, you can assign $j like so:

<script src="https://example.foxycart.com/files/foxycart_includes.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
	var $j = jQuery.noConflict();

For more information on jQuery's noConflict mode please see the official documentation.

Setting jQuery back to "conflict" mode (default)

For FoxyCart versions prior to v051, you can remap the $j that FoxyCart uses for jQuery back to just $ by putting this code after your foxycart_includes.js call:

<script type="text/javascript" charset="utf-8">
var $ = jQuery.noConflict();

FoxyDomain Errors / Using Only Pieces of ''foxycart_includes.js'' Locally

If you need to pull out only specific parts of the foxycart_includes.js file, make sure you do include the line from the foxycart_includes.js file that defines your FoxyDomain, as that's required for the FoxyCart javascript to function properly. What that looks like exactly will vary by version, but it'll generally look something like this:

<script type="text/javascript">
if (typeof(FoxyDomain) == 'undefined') {
	var FoxyDomain = "secure.mysitedomain.com";

Site Tools