Documentation You are here: start » v » 0.6.0 » docs » checkout » prepopulating

Pre-Populating the Checkout Fields

What It Does

Versions v0.6.0 and above

v060 introduced a true guest checkout mode, which (when paired with Single Sign-On and the API provides a much more robust and powerful method to accomplish checkout pre-population. We recommend using other options, but you can still pre-populate checkout fields as described below. The difference is that pre-populating no longer creates a “one-time-use” user

Versions v0.5.1 and below

You can pre-populate (ie. fill in the values automatically) on the checkout for any of the following fields. Note that this flips the checkout into “one-time-use” user mode, and bypasses the password field. Note: This method is not meant to be used with subscriptions. It will create a customer with a randomly generated password so subscriptions will technically work, but the customer will not be able to login to update their information using updateinfo or the sub_token unless they first use the “forgot my password” functionality on the checkout page.

How It Works

To pre-populate the checkout, you need to add one of the following values to your cart, during a normal or JSONP “add to cart” request. The value then becomes a “session value” and will be used once the customer proceeds to checkout.

Available Fields

customer_first_name
customer_last_name
customer_email
customer_address1
customer_address2
customer_city
customer_state
customer_postal_code
customer_country
customer_phone
shipping_first_name
shipping_last_name
shipping_address1
shipping_address2
shipping_city
shipping_state
shipping_postal_code
shipping_country
shipping_phone

v0.5.1 and below: Checkout Without Password

NOTE: v060 introduced a guest checkout mode, rendering this below described method obsolete. It is preserved here for reference only.

You can switch the checkout into “one-time-use” user mode (which allows checkout without password) by passing in an empty value for any of the above fields. Something like

<input name="shipping_phone" value="." />

or… http://yourdomain.foxycart. com/cart?name=blah&price=9.99&shipping_phone=%20 (%20 is a URL encoded space.)

For reference, %2B is the code for a URL-encoded plus-sign.

This (fake) empty value is passed in on an “add to cart” request. So you'd add the extra “fake” empty value on any add-to-cart links or forms you have. Once FoxyCart gets the value it is set for the session, so it's not necessarily required to re-enter it with every request, but that's probably the easiest method.

Site Tools