Documentation You are here: start » v » 0.6.0 » docs » gettingstarted » cartinfo

Basic Cart Information

You can quickly and easily add your customers' cart info like this:

This functionality is built into the foxycart_includes.js files that you are probably including in your site. To activate this functionality, simply create something like this:

<p>
	Your cart: <br />
	<span id="fc_quantity">0</span> items.<br />
	$<span id="fc_total_price">0.00</span>
</p>

The fc_quantity and fc_total_price spans are reset with the customer's cart values on page load or when their cart is closed (if you're using the standard foxycart_includes.js FoxyBox method).

Hiding the "MiniCart" when Products = 0

NOTE: The #fc_minicart functionality is available from v0.2.8 on.

If you'd like to show or hide an element (like a div) based on the cart quantity, you can achieve this with the ID fc_minicart. If fc_quantity is 0, #fc_minicart will be hidden (display:none). Otherwise it will be shown.

<div id="fc_minicart">
	Your cart: <br />
	<span id="fc_quantity">0</span> items.<br />
	$<span id="fc_total_price">0.00</span>
</div>

You probably want to add some CSS to hide #fc_minicart (using display:none) as this will avoid potential “flashes” before the javascript (in foxycart_includes.js) runs, and hides the div (if there are no products in it).

You can also link your mini-cart to display your full cart, which might look like this:

<div id="fc_minicart">
	<a href="https://YOURSUBDOMAIN.foxycart.com/cart?cart=view" class="foxycart">
		Your cart: <br />
		<span id="fc_quantity">0</span> items.<br />
		$<span id="fc_total_price">0.00</span>
	</a>
</div>

Site Tools