less than a minute read • Updated 8 minutes ago
Configure JavaScript loading options
How to override Foxy's JavaScript defaults, like debug logging, using FC.override before Foxy's script loads.
Some of Foxy’s JavaScript defaults can be overridden with a small config object, for situations where a template config option in the admin isn’t available or doesn’t apply to your own site.
How to set it up
Add this code before you include Foxy’s JavaScript:
var FC = FC || {};
FC.override = FC.override || {};
FC.override.PROPERTY = VALUE;
FC.onLoad = function () {
// Attach FC event handlers here, before FC is defined. Like this:
FC.client.on('ready.done', function () {
// custom code goes here
});
};
Replace PROPERTY and VALUE with one of the available options below.
Available properties
debug— if set totrue, enables Foxy’sFC.util.log()method so you can see what’s happening. This is also available as a template config value in the admin, but that value doesn’t take effect on pageload on your own site — it only works on the full-page cart, checkout, and receipt. UseFC.override.debugif you need logging on your own site.onLoad— a function that runs once, right beforeFC.client.init()is called. See JavaScript Overview for how this is used to attach event handlers safely.
Notes
This code must run before Foxy’s JavaScript is included, or the overrides won’t take effect.
For the full list of events you can attach inside
onLoad, see JavaScript events reference.