Table of Contents
Templates, Caching, and Template Customization with HTML + CSS
FoxyCart's templates are beautiful and responsive out of the box with the new default templates available in 2.0. Paired with the new template configuration, you can even customise the templates without having to touch a single line of code.
Under the hood though, we make use of some standards and systems that make the templates extremely flexible and customizable, so that if you need, you can alter the raw markup of the page to suite your needs.
Working with FoxyCart Templates
- Basic Customizations
Utilising the new configuration option for common changes - Intermediate Customizations
Incorporating your own designs in the FoxyCart templates - Advanced Customizations
Altering the raw templates - Template View Data
Cheatsheet for the variables accessible on the templates
Basic Customizations
Adding your own logo
You can set your store logo in the Settings tab of your FoxyCart Store's Admin. There, you can add the url for your store's logo to the “logo url” field. We'll also securely cache your logo from that URL to ensure it and your templates are served securely.
If you don't already have a copy of your logo someplace online, an alternate option is to add the logo to a Dropbox folder, then follow these steps:
- Use the share link to get the link to your image.
- In the resulting URL, change the start from
https://www
tohttps://dl
and load it in your browser - When loaded in your browser, you should see only your image and nothing else. Copy the URL as it currently is set in your browser, it will be slightly different than you pasted previously.
- Paste the updated URL as the store logo in your FoxyCart administration
As an example, your share URL might be https://www.dropbox.com/s/ggq5g1qpvonh0/My%20Logo.jpg?dl=0
, and after updating it would be something like https://dl.dropboxusercontent.com/s/ggq5g1qpvonh0/My%20Logo.jpg?dl=0
. That's an easy and free way to get your logo hosted someplace that we can access it from.
Other Common Customizations
FoxyCart supports many common template customizations from the Template Configuration page in the admin. You can configure:
- Guest checkout settings (forcing guest, forcing account, allowing both but defaulting to one or the other).
- Adding a Terms of Service (TOS) checkbox and link.
- Newsletter opt-in checkbox.
- Color settings to control the major color styles on the cart, checkout and receipt. To change the color of all your buttons, take a look at this article.
- Product option hiding. You can hide product options or your own custom product options using the
Customize Cart Display
checkbox. Hide weight, code, category, subscription details, custom options, or all options. This will hide the items in the list for which you've removed the checkbox from the cart, checkout, web receipt, and email receipt. - Customize (remove or add) what credit card options you support. (If you don't accept AmEx, uncheck that box. Note that this only changes the display, not what your payment gateway actually accepts.)
- Credit card security code requirements. (Required, optional, etc.) Step by Step instructions here
- Change what billing checkout fields are required and displayed. (Don't collect the address info if you aren't shipping. Require a phone field. Etc.) Note: If you have shippable products present in the cart, the complete shipping address is always require.
- Add custom content (HTML, JS) to your templates, for custom styles, tracking codes or custom fields on your checkout.
- Enable debug logging to your browsers console.
- Shipping and billing country/region allowing/blocking. If you only want to accept customers or to ship to certain countries, you can do that here. Step-by-step instructions for allowing or blocking are here.
Minor Language Customizations
Much of the language of the Foxy cart, checkout, and receipt can be modified in the TEMPLATES language customization of the Foxy admin. Expand each area or show all details to see the strings available for you to customize.
Minor Styling Customizations
Using the custom code template setting, it's now possible to add CSS and javascript to your templates without needing to modify the templates themselves. If you just want to change the background, some colors or styling, or anything else you accomplish with CSS only, we strongly recommend taking this approach.
You can customize your styling in the “configuration” section of your store's Foxy admin by checking the Add custom header and footer code to your templates
and inserting your styles in the custom header:
text box like this:
<style> #fc .fc-form-control { background: #cc33cc; } </style>
This changes the background of entry boxes to magenta.
To see what classes you need to use, we recommend making use of an inspection tool - which most modern browsers will have built in. By using their inspection tools, you can select a given element on the page and the tool will show you the markup that outputs that element and you'll then be able to see the classes that apply to it.
For information on the different browser development tools - see the following:
Customising the SVG Icons
Within the cart and checkout there are a few instances of SVG icons that are used for things like arrows and padlocks. Styling these elements are a little different than above, as you need to target the source element of the icon and alter it using fill
. The following are the different icons that we currently include and their default fill colors (some may have different colors applied in specific locations that differ to the following):
/* Used within continue shopping button on full-page cart/checkout */ #fc .fa-angle-double-left, #fc .fc-cancel-continue-shopping svg { fill: #666; } /* Used within continue shopping button on sidecart */ #fc .fa-caret-left, #fc .fc-sidecart-only-fixed .fc-fixed-button-left svg { fill: #FFF; } /* Used within top proceed to checkout button on sidecart */ #fc .fa-caret-right, [data-fc-sidecart] #fc .fa-caret-right, #fc .fc-sidecart-only-fixed .fc-fixed-button-right svg { fill: #888; } /* Used within bottom proceed to checkout button on sidecart and credit card field on tablet/mobile checkout */ #fc .fa-lock, #fc-cart .fc-action--checkout--button svg, #fc .fc-checkout__section--payment svg.fc-svg-icon--lock { fill: #C1DB9B; } /* Used within payments section on full-size checkout */ #fc .fa-lock-large, #fc .fc-checkout__section--payment svg#fc-icon-lock-large { fill: #EEE; } /* Used within remove coupon option */ #fc .fa-times-circle, #fc .fc-transaction__discounts .fc-action--close svg { fill: #666; } /* Used within shipping fields on sidecart */ #fc .fa-truck, #fc .fc-address-entry svg { fill: #999; } /* Used within tax fields on sidecart */ #fc .fa-bank, #fc .fc-address-entry svg { fill: #999; } /* Used within address validation modal */ #fc .fa-map-marker { fill: #999; }
Use any of the applicable CSS rules above, altering the fill color code to customise as needed.
Common responsive CSS media queries
If you are adding custom styles, you may have a need to apply different styles based on the viewport the user is using. The following are the common media queries we utilise in our default styles to match into similar break points as us. You would just need to use the specific queries here based on your specific style requirements:
@media (max-width: 480px) { } @media (min-width: 768px) { } @media (min-width: 768px) and (max-width: 991px) { } @media (min-width: 992px) { } @media (min-width: 992px) and (max-width: 1199px) { } @media (min-width: 1200px) { }