If you haven't already read “FoxyCart is different” a dozen times by now, we'll state it again: FoxyCart is different, and we recommend reading more about what FoxyCart is and isn't. Most e-commerce systems have a built in CMS, which controls not only your website, but also the way your products are displayed, and thus, your products themselves.
FoxyCart is not a CMS, and as such doesn't control your site, nor does it manage your products. The implications of this paradigm shift are far reaching, and depending on your needs it may make FoxyCart the perfect solution.
So where do your products live? And what is a product? That's a good question. Simply put, a “product” in FoxyCart is simply anything that exists in the cart (put there via a GET or POST request, if you want specifics). There are no limitations on what types of products you can create, how you create them, how many options they have, or etc. If you can build an add-to-cart link or form, FoxyCart can almost always handle the product.
Products “live” on your site, and because you have ultimate control, you can approach products from a variety of ways.
There are three “types” of products in FoxyCart:
To add a product to your cart, there are two methods you can use: a link or a form. If you go to the “sample code” section of your store's admin you'll find a link and a form for you to copy/paste into your own site to see how it works. (We recommend starting from that sample code if you're unfamiliar with FoxyCart.)
Links are usually the easiest option, and there are less chances for things to go wrong, but they are limited in that they cannot be changed (unless you're generating links dynamically). So whatever your add-to-cart link is for, that's it. No options, no quantity selection, no radio buttons or select boxes for product options. A simple link will look like this:
<a href="https://YOURDOMAIN.foxycart.com/cart?name=A great product&price=5"> Buy this Great Product! </a>
If you can use a link, you probably should use a link, but if you need customers to configure their own products, read on for an example of a form.
Forms have many potential advantages, including the ability to use dropdowns or other input fields to set options (like size, color, etc.). To add a product using a form, you'd do something like this.
<form action="https://YOURDOMAIN.foxycart.com/cart" method="post"> <input type="hidden" name="name" value="A great product" /> <input type="hidden" name="price" value="5.00" /> <select name="size"> <option value="small">Small</option> <option value="medium">Medium</option> <option value="large">Large</option> </select> <input type="submit" value="Buy It Now!" /> </form>
You are limited only by your imagination when it comes to how you'd like your add-to-cart links or forms to function, and thus, how complex you want your products to be. There are a variety of options and parameters listed below as well as in the cheatsheet. If you need help just ask on our forum.
If you're following along, you may be asking yourself, “That's all well and good, but there's no security in that approach.” That's an excellent observation, and we have created a solution to this problem that we believe to be the most advanced and flexible approach to this problem in the world. We call it our HMAC Product Verification, and we encourage you to read more about it. If you're using PHP, there's a helper class that will automatically sign your HTML, so implementing this security enhancement may be much easier than you think.
Because FoxyCart doesn’t actually have any knowledge of your store's products, there is nothing to import into FoxyCart. If you do need to migrate from one system to another you would need to explore your options to import into whatever new CMS you’re using. For example, if you’re moving from Yahoo Stores to Wordpress, importing products is much less a question of getting the products into FoxyCart as it is getting the products into Wordpress. So long as your new system can generate links or forms, FoxyCart will function as expected.
name
&name=My Example Product
price
&price=9.99
image
http: or
https:
, or a relative path to the image from the store's domain (as configured in the store settings).&image=http://example.com/path/to/image.jpg
, &image=local/path/to/image.png
url
http: or
https:
, or a relative path to the produt from the store's domain (as configured in the store settings).&url=http://example.com/path/to/product
, &url=local/path/to/product
image
parameter is also present, and will be wrapped around the image in the cart.code
&code=ISBN 978-0-12-345678-9
quantity
1
&quantity=3
quantity
input be an input[type=text]
or select
element to allow the customer to enter or choose their desired quantity.quantity_max
quantity_max
cannot apply to groupings of multiple products. Also, this value does not control inventory. The values are per cart/transaction/session.quantity_min
quantity_min
cannot apply to groupings of multiple products. Also, this value does not control inventory. The values are per cart/transaction/session.category
weight
shipto
shipto
value on checkout and in the cart display (if multi-ship is enabled).id
id
for a product already in the cart.id
from one session to another.1:
, 2:
, 3:
, 4:
, etc…1:
.<form action="http://YOURDOMAIN.foxycart.com/cart" class="foxycart" method="post"> <input type="hidden" name="name" value="Fancy Smartphone" /> <input type="hidden" name="price" value="199.99" /> <input type="hidden" name="2:name" value="Leather Case for Smartphone" /> <input type="hidden" name="2:price" value="9.99" /> <input type="submit" value="Buy a Smartphone and a Leather Case!" /> </form>
&color=green&size=XXL
. If an attribute is passed in with a name not otherwise reserved, it will be added as a product option.Please see Coupons and Discounts for a complete discussion of how discounts are applied. The following is for reference only.
discount_quantity_amount
$/qty
.discount_quantity_percentage
%/qty
.discount_price_amount
$/$
.discount_price_percentage
%/$
.allunits
allunits
is the default discount type for quantity discounts applied to products. If a discount type isn't specified, allunits
is applied.discount_quantity_amount=My Discount{allunits|2-2}
: Buy two products, take $2 off of both.discount_quantity_percentage=My Discount{allunits|5-10|10-20}
: Orders of five or more get a 10% on every item ordered. Orders of 10 or more get a 20% discount on every item ordered.incremental
$/$
discount methods.discount_quantity_amount=My Discount{incremental|3-5}
: Buy two products, get additional products at $5 off. (The first two are not discounted.)discount_quantity_percentage=My Discount{incremental|11-10|51-15|101-20}
: With a quantity of 1-10, all products are at 100%. With a quantity of 150, 10 products would be at 100%, 40 would be at 90%, 50 would be at 85%, and 50 would be at 80%.repeat
incremental
discounts, but only have a single tier that repeats. Using this method you can achieve “buy one get one free” types of discounts that repeat (buy 1 get 1, or buy 3 get 3). You can also do something like “buy 3 get the 4th at $5 off”, so buying 5 or 6 would only get a single $5 discount, but buying 8 would get a $10 discount.$/$
discount methods. Only accepts one tier.discount_quantity_percentage=My Discount{repeat|2-100}
: Buy one, get one free (100% off).discount_quantity_percentage=My Discount{repeat|4-50}
: Buy 3, get the 4th at 50% off.single
single
discount type applies one single discount and not a quantity discount across all products.single
is the default discount type for coupons, as it makes the most sense in that context. For %/qty
and %/$
a single
discount type will yield the same discount as allunits
.discount_quantity_amount=My Discount{single|5-10}
: Buy any 5 products, get $10 off your order.discount_method=Discount_Name{discount_type|X-A|Y-B|Z-C}
discount_method
: One of the Discount Methods above.Discount_Name
: The text label applied to the discount and displayed to the customer in the cart. For example, “Summer Special” or “Local Coupon Discount”. A discount name is required for discounts to apply properly on cart pageloads.discount_type
: A Discount Type from above. Optional. Will default to single
if a coupon, or allunits
otherwise.X
, Y
, Z
: “Discount Tiers”. The threshold at which the Discount Amount will apply.A
, B
, C
: “Discount Amounts”. The amount or percentage discount to apply.sub_frequency
60d
= every 60 days.2w
= every two weeks. For date calculations, 1w
= 7d
.1m
= every month. When you use the m
unit, FoxyCart will assign billing to the current (or assigned) day of the month, to be repeated every x
months. The date will be moved up when necessary; if set to the 31st, it will process on the 30th of months with 30 days (or 28th/29th of February).1y
= every year. .5m
= twice a month. IMPORTANT: The .5
value only works with m
(months). This value will setup bi-monthly subscriptions, once on the start date, and again 15 days later. Example: if you set it to start on the 3rd, it will run on the 3rd and the 18th of each month.sub_frequency
is required for a product to be treated as a subscription by FoxyCart.sub_startdate
YYYYMMDD
format or just pass in the day of this month in the DD
or D
format. If you pass through a day that has already past, it will start on that day next month.YYYYMMDD
= Example: 20070131
= January, 31 2007.DD
= Example: 10
= will run on the 10th of this month or the 10th of next month if today's date is after the 10th.D
= Same as DD
.sub_startdate
will generally be used for all subsequent billing attempts when used with a monthly frequency, but in cases where the date doesn't exist in a month, it will be moved ahead for that month. So if you have a subscription with a start date on Jan-31, it will run on the Feb-28, Mar-31, Apr-30, and etc.sub_enddate
YYYYMMDD
formatted date value in the future.sub_enddate
is the 4th, the subscription will end before it is billed to the customer. So, this parameter should be set to a date after the date you want the last transaction in the subscription to run. For example, if you have a monthly subscription starting on January 1st, 2010 that is supposed to run for six months and then stop, set sub_endate
to 20100602 (June 2nd, 2010) so that the transaction on June 1st is not cancelled by the end date.sub_token
redirect
feature as you can load up a customer's subscription and then redirect them back to your product page so they can add something to it.sub_token
(retrieved from the API, XML datafeeds, or admin).sub_token
is loaded by the customer, the customer's cart is emptied and replaced by the content of the subscription represented by the sub_token
.sub_cancel
sub_token
) should be cancelled. By “canceling”, the subscription gets a sub_enddate
of “tomorrow” (whatever date that may be).true
sub_token
to function. Otherwise there will not be any subscription to cancel.
Product option modifiers allow you to modify the price
, weight
, code
, or category
when another option is set. Modifiers are placed inside curly brackets ({}
) at the end of your product option, and can add to (+
), subtract from (-
), or set (:
) new values to the modified option. Multiple modifiers can be chained together with the “pipe” symbol (|
), like value=“S{p+1.50|w-1|c:01a|y:teeny_category}”
. When using cart validation it is recommended to set your initial values high then modify down, rather than the other way around. See the validation docs for explanation. Note: if you're working with a product code modifier, be sure your code input comes before your product option that modifies it.
p
&size=Small{p+5}
&size=Small{p-5}
&size=Small{p:5}
w
price
modifier above.c
&code=foo&size=Small{c:bar}
would yield a code
of bar
&code=foo&size=Small{c+bar}
would yield a code
of foobar
y
&category=foo&size=Small{y:bar}
would yield a category
of bar